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 /Modules | |
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 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineFortranCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeFindBinUtils.cmake | 12 | ||||
-rw-r--r-- | Modules/CMakeForceCompiler.cmake | 4 | ||||
-rw-r--r-- | Modules/FindMPI.cmake | 2 | ||||
-rw-r--r-- | Modules/FortranCInterface/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Modules/Platform/eCos.cmake | 2 |
9 files changed, 21 insertions, 21 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 6b425c6..937aa8c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -108,7 +108,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) # Set old compiler and platform id variables. - if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_C_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUCC 1) endif() if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW") @@ -131,11 +131,11 @@ endif () # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) - if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) endif() @@ -150,7 +150,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) endif () - elseif("${CMAKE_C_COMPILER_ID}" MATCHES "TI") + elseif(CMAKE_C_COMPILER_ID MATCHES "TI") # TI compilers are named e.g. cl6x, cl470 or armcl.exe get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index a7b5760..9ab159a 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -48,7 +48,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) endif() - if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL GNU) + if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") execute_process( COMMAND "${CMAKE_${lang}_COMPILER}" -V diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 96df6a2..a4bb86c 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -152,12 +152,12 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) endif() # Set old compiler and platform id variables. - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUG77 1) endif() - if("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") + if(CMAKE_Fortran_PLATFORM_ID MATCHES "MinGW") set(CMAKE_COMPILER_IS_MINGW 1) - elseif("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin") + elseif(CMAKE_Fortran_PLATFORM_ID MATCHES "Cygwin") set(CMAKE_COMPILER_IS_CYGWIN 1) endif() endif() @@ -175,7 +175,7 @@ endif () # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 365d381..92b0d1d 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -90,7 +90,7 @@ set(ENV{LANG} C) # Now check for C, works for gcc and Intel compiler at least if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) - if ("${CMAKE_C_COMPILER_ID}" MATCHES GNU OR "${CMAKE_C_COMPILER_ID}" MATCHES Intel OR "${CMAKE_C_COMPILER_ID}" MATCHES Clang) + if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_C_COMPILER_ID MATCHES Clang) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines) set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros") diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index e0ba131..50cb972 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -30,12 +30,12 @@ # License text for the above reference.) # if it's the MS C/CXX compiler, search for link -if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" - OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC" - OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC" - OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" - OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" - OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" +if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_C_COMPILER_ID STREQUAL "MSVC" + OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" + OR (CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 0e6b5af..1d8b110 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -70,7 +70,7 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) set(CMAKE_C_COMPILER_FORCED TRUE) # Set old compiler id variables. - if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_C_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUCC 1) endif() endmacro() @@ -94,7 +94,7 @@ macro(CMAKE_FORCE_Fortran_COMPILER compiler id) set(CMAKE_Fortran_COMPILER_FORCED TRUE) # Set old compiler id variables. - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUG77 1) endif() endmacro() diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 3be5e3c..ba4ea5b 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -160,7 +160,7 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95 # or if we know it matches the regular compiler. foreach (lang C CXX Fortran) foreach (id GNU Intel PGI XL) - if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}") + if (NOT CMAKE_${lang}_COMPILER_ID OR CMAKE_${lang}_COMPILER_ID STREQUAL id) list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES}) endif() unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index b6232ed..721a262 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -71,7 +71,7 @@ endif() # Generate C symbol sources. set(symbol_sources) -if(NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(PathScale|Cray)$") +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(PathScale|Cray)$") # Provide mymodule_ and my_module_ init symbols because: # - PGI Fortran uses module init symbols # but not for: diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake index a203826..e1279ef 100644 --- a/Modules/Platform/eCos.cmake +++ b/Modules/Platform/eCos.cmake @@ -28,7 +28,7 @@ include(Platform/UnixPaths) # eCos can be built only with gcc get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) -if(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) +if(CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT _IN_TC) message(FATAL_ERROR "GNU gcc is required for eCos") endif() if(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) |