Avoid if() quoted auto-dereference when checking for "MSVC"

When testing CMAKE_<LANG>_COMPILER_ID values against "MSVC", do not
allow the definition of the "MSVC" variable to be expanded.
This commit is contained in:
Fraser Hutchison 2014-11-19 09:21:27 +00:00 committed by Brad King
parent 54ff77dc62
commit 543c4304bb
5 changed files with 12 additions and 12 deletions

View File

@ -30,12 +30,12 @@
# License text for the above reference.) # License text for the above reference.)
# if it's the MS C/CXX compiler, search for link # if it's the MS C/CXX compiler, search for link
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC" OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})

View File

@ -1,6 +1,6 @@
include(Compiler/Clang) include(Compiler/Clang)
__compiler_clang(CXX) __compiler_clang(CXX)
if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif() endif()

View File

@ -1,7 +1,7 @@
include(Compiler/Clang) include(Compiler/Clang)
__compiler_clang(CXX) __compiler_clang(CXX)
if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif() endif()

View File

@ -18,8 +18,8 @@ if(__COMPILER_CLANG)
endif() endif()
set(__COMPILER_CLANG 1) set(__COMPILER_CLANG 1)
if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
macro(__compiler_clang lang) macro(__compiler_clang lang)
endmacro() endmacro()
else() else()

View File

@ -18,8 +18,8 @@ if(__WINDOWS_CLANG)
endif() endif()
set(__WINDOWS_CLANG 1) set(__WINDOWS_CLANG 1)
if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
include(Platform/Windows-MSVC) include(Platform/Windows-MSVC)
macro(__windows_compiler_clang lang) macro(__windows_compiler_clang lang)
__windows_compiler_msvc(${lang}) __windows_compiler_msvc(${lang})