fix OpenMP detection on Mac OS broken by a6fee0b
authorSzilárd Páll <pszilard@cbr.su.se>
Thu, 17 Jan 2013 02:36:08 +0000 (03:36 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 18 Jan 2013 03:16:00 +0000 (04:16 +0100)
Compiler version check was done before the version got detected. This
code will avoid false positives even if the compiler version is not
available (although for GNUCC it should always be).

Change-Id: I554f13e4b101ae7c9f70674e966065bf9fcf2b27

CMakeLists.txt

index 3a34b8b6a9cf463abe5cbb518a42e2b729db9ac3..41ea6a8d197aa5283d248196ca1f655dca22ebf4 100644 (file)
@@ -229,11 +229,16 @@ if(CMAKE_CXX_COMPILER_LOADED)
     include(CheckCXXCompilerFlag)
 endif()
 
+# Get compiler version information, needs to be done early as check that depend
+# on compiler verison follow below.
+include(gmxGetCompilerInfo)
+get_compiler_version()
+
 # First exclude compilers known to not work with OpenMP although claim to support it:
 # gcc 4.2.1 and gcc-llvm 4.2.1 (also claims to be 4.2.1) on Mac OS X
 # This fixes redmine 900 and needs to run before OpenMP flags are set below.
 if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
-    CMAKE_COMPILER_IS_GNUCC AND C_COMPILER_VERSION VERSION_LESS 4.3)
+    (CMAKE_COMPILER_IS_GNUCC AND C_COMPILER_VERSION AND C_COMPILER_VERSION VERSION_LESS 4.3))
     message(STATUS "OpenMP multithreading not supported with gcc/llvm-gcc 4.2 on Mac OS X, disabled")
     set(GMX_OPENMP OFF CACHE BOOL
         "OpenMP multithreading not not supported with gcc/llvm-gcc 4.2 on Mac OS X, disabled!" FORCE)
@@ -270,9 +275,6 @@ endif()
 include(gmxCFlags)
 gmx_c_flags()
 
-include(gmxGetCompilerInfo)
-get_compiler_version()
-
 # gcc 4.4.x is buggy and crashes when compiling some files with O3 and OpenMP on.
 # Detect here whether applying a workaround is needed and will apply it later
 # on the affected files.