summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCXXCompiler.cmake
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-08-20 02:40:38 (GMT)
committerBrad King <brad.king@kitware.com>2015-08-20 13:35:16 (GMT)
commitdc8822f0a7b4152c5cb880e6a7fccada767e2fb1 (patch)
tree3279bb2735c38bf3b496eb1f5f489a3f168d167e /Modules/CMakeDetermineCXXCompiler.cmake
parent4a6fe0290880bd56dd5141f06c9fa2b9e310162e (diff)
downloadCMake-dc8822f0a7b4152c5cb880e6a7fccada767e2fb1.zip
CMake-dc8822f0a7b4152c5cb880e6a7fccada767e2fb1.tar.gz
CMake-dc8822f0a7b4152c5cb880e6a7fccada767e2fb1.tar.bz2
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>
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 893c454..18e735b 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -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()