diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d8bdcf8abbcc0a4d58631c0af404520d76f9dd7..7c6972d6927ea2f76e8f63264dd981a5761b1f14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,18 +47,15 @@ if (CMAKE_COMPILER_IS_GNUCC)
   if (GCC_VERSION VERSION_GREATER_EQUAL 7.0)
     message(STATUS "Detected gcc > 7.0 - switching on support for c++17")
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
-  else (GCC_VERSION VERSION_LESS 7.0)
-    if (GCC_VERSION VERSION_EQUAL 4.4.7)
-      message(STATUS "Detected gcc = 4.4.7 - build cmdline only with c++0x")
-      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-      set (BUILD_CMDLINE_ONLY TRUE)
-    endif (GCC_VERSION VERSION_EQUAL 4.4.7)
-    if (GCC_VERSION VERSION_GREATER 4.4.7)
-      message(STATUS "Detected gcc > 4.4.7 - switching on support for c++1y")
-      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
-    endif (GCC_VERSION VERSION_GREATER 4.4.7)
-  endif (GCC_VERSION VERSION_GREATER_EQUAL 7.0)
-endif (CMAKE_COMPILER_IS_GNUCC)
+  elseif (GCC_VERSION VERSION_EQUAL 4.4.7)
+    message(STATUS "Detected gcc = 4.4.7 - build cmdline only with c++0x")
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+    set (BUILD_CMDLINE_ONLY TRUE)
+  elseif (GCC_VERSION VERSION_GREATER 4.4.7)
+    message(STATUS "Detected gcc > 4.4.7 - switching on support for c++1y")
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
+  endif ()
+endif ()
 
 # CTA continue using the old ABI, so we should force it. This command only works on cmake3,
 # so we should update the requeriments of CMakeLists