Avoid using undefined CMake variables
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 19 Dec 2012 12:04:52 +0000 (13:04 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 19 Dec 2012 12:11:59 +0000 (13:11 +0100)
C_COMPILER_VERSION is not defined before CMake 2.8.8, so the logic
and reporting was wrong. However, we already have a work-around.

Change-Id: If34deadf3a912d48e204d80cc5be7718c151e39d

cmake/gmxBuildTypeReference.cmake

index 09401b5bca037d298ef5bfa24d150f182b34b425..195657e533906a8e226736c4d9afa3430daac893 100644 (file)
@@ -47,8 +47,12 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Reference")
     set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Disabled for regressiontests reference builds" FORCE)
     set(GMX_THREAD_MPI OFF OFF CACHE BOOL "Disabled for regressiontests reference builds" FORCE)
 
+    # C_COMPILER_VERSION is not defined automatically for CMake below 2.8.8,
+    # so we call the GROMACS work-around for that
+    include(gmxGetCompilerInfo)
+    get_compiler_version()
     if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR NOT "${C_COMPILER_VERSION}" MATCHES "4.7")
         message(WARNING "Reference values for regressiontests should use Gromacs compiled with "
-                        "gcc-4.7, but your configuration is using ${CMAKE_C_COMPILER_ID}-${C_COMPILER_VERSION}.")
+            "gcc 4.7, but your configuration is using ${CMAKE_C_COMPILER_ID}-${C_COMPILER_VERSION}.")
     endif()
 endif()