Browse Source

Modules/Test*.cmake: Use if(DEFINED) to simplify conditions

Replace old hacks of the form 'if("${VAR}" MATCHES "^${VAR}$")'
with the much simpler 'if(NOT DEFINED ${VAR})'.
Brad King 11 years ago
parent
commit
0b12815dc2

+ 1 - 1
Modules/TestBigEndian.cmake

@@ -25,7 +25,7 @@
 #  License text for the above reference.)
 
 macro(TEST_BIG_ENDIAN VARIABLE)
-  if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+  if(NOT DEFINED HAVE_${VARIABLE})
     message(STATUS "Check if the system is big endian")
     message(STATUS "Searching 16 bit integer")
 

+ 1 - 1
Modules/TestForANSIForScope.cmake

@@ -24,7 +24,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
+if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
   message(STATUS "Check for ANSI scope")
   try_compile(CMAKE_ANSI_FOR_SCOPE  ${CMAKE_BINARY_DIR}
     ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx

+ 1 - 1
Modules/TestForSSTREAM.cmake

@@ -23,7 +23,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-if("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$")
+if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
   message(STATUS "Check for sstream")
   try_compile(CMAKE_HAS_ANSI_STRING_STREAM  ${CMAKE_BINARY_DIR}
     ${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx

+ 1 - 1
Modules/TestForSTDNamespace.cmake

@@ -23,7 +23,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-if("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
+if(NOT DEFINED CMAKE_STD_NAMESPACE)
   message(STATUS "Check for STD namespace")
   try_compile(CMAKE_STD_NAMESPACE  ${CMAKE_BINARY_DIR}
     ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx