diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-10-14 14:25:32 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2014-10-20 15:49:16 (GMT) |
commit | 29c3edb87adedd82e816552d958f4c3540a1511b (patch) | |
tree | 089cea993a6c212b2107554eeca443e48993ca08 /Utilities | |
parent | a7596fef6e8d6938ce0d7fcba47e896f288b12b4 (diff) | |
download | CMake-29c3edb87adedd82e816552d958f4c3540a1511b.zip CMake-29c3edb87adedd82e816552d958f4c3540a1511b.tar.gz CMake-29c3edb87adedd82e816552d958f4c3540a1511b.tar.bz2 |
Avoid if() quoted auto-dereference
When testing CMAKE_<LANG>_COMPILER_ID values, do not explicitly
dereference or quote the variable. We want if() to auto-dereference the
variable and not its value. Also replace MATCHES with STREQUAL where
equivalent.
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/KWIML/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Utilities/cmlibarchive/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Utilities/cmliblzma/CMakeLists.txt | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt index a2359cc..a16b5cd 100644 --- a/Utilities/KWIML/test/CMakeLists.txt +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -20,7 +20,7 @@ set_property(DIRECTORY # Suppress printf/scanf format warnings; we test if the sizes match. foreach(lang C CXX) - if(KWIML_LANGUAGE_${lang} AND "${CMAKE_${lang}_COMPILER_ID}" STREQUAL GNU) + if(KWIML_LANGUAGE_${lang} AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") endif() endforeach() diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index f1459d4..3f41dd1 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -56,10 +56,10 @@ SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_FLAGS) # Disable warnings to avoid changing 3rd party code. -IF("${CMAKE_C_COMPILER_ID}" MATCHES +IF(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") -ELSEIF("${CMAKE_C_COMPILER_ID}" MATCHES "^(PathScale)$") +ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") ELSEIF(BORLAND) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") @@ -666,14 +666,14 @@ ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) IF(NOT HAVE_ICONV) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + IF (CMAKE_C_COMPILER_ID STREQUAL "GNU") # # During checking iconv proto type, we should use -Werror to avoid the # success of iconv detection with a warnig which success is a miss # detection. So this needs for all build mode(even it's a release mode). # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + ENDIF (CMAKE_C_COMPILER_ID STREQUAL "GNU") IF (MSVC) # NOTE: /WX option is the same as gcc's -Werror option. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 23549c5..4f2b9ba 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -201,10 +201,10 @@ INCLUDE_DIRECTORIES( ) # Disable warnings to avoid changing 3rd party code. -IF("${CMAKE_C_COMPILER_ID}" MATCHES +IF(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") -ELSEIF("${CMAKE_C_COMPILER_ID}" MATCHES "^(PathScale)$") +ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") ELSEIF(BORLAND) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") |