CMakeDetermine{C,CXX}Compiler: Avoid if() auto-dereferene in quoted arguments
Exposed by a CMP0054 warning with code like: cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) project(MyProj NONE) enable_language(C) enable_language(CXX) While at it, use STREQUAL for testing the compiler id against "GNU". Suggested-by: Rolf Eike Beer <eike@sf-mail.de>
This commit is contained in:
parent
4a6fe02908
commit
dc8822f0a7
|
@ -95,6 +95,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
|
|||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_C_COMPILER_ID)
|
||||
set(CMAKE_C_PLATFORM_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_C_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
|
@ -108,12 +109,12 @@ 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 STREQUAL "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
endif()
|
||||
if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
|
||||
if(CMAKE_C_PLATFORM_ID MATCHES "MinGW")
|
||||
set(CMAKE_COMPILER_IS_MINGW 1)
|
||||
elseif("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin")
|
||||
elseif(CMAKE_C_PLATFORM_ID MATCHES "Cygwin")
|
||||
set(CMAKE_COMPILER_IS_CYGWIN 1)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -90,6 +90,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
|
|||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_CXX_COMPILER_ID)
|
||||
set(CMAKE_CXX_PLATFORM_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
|
@ -103,12 +104,12 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
|
|||
CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp)
|
||||
|
||||
# Set old compiler and platform id variables.
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX 1)
|
||||
endif()
|
||||
if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
|
||||
if(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW")
|
||||
set(CMAKE_COMPILER_IS_MINGW 1)
|
||||
elseif("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin")
|
||||
elseif(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
|
||||
set(CMAKE_COMPILER_IS_CYGWIN 1)
|
||||
endif()
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue