Features: Quote all compiler names when comparing with COMPILER_ID

In preparation of adding MSVC support we need to quote all compiler names,
as MSVC is also a CMake variable.
This commit is contained in:
Robert Maynard 2015-01-06 13:31:30 -05:00 committed by Stephen Kelly
parent 07d1f6fca1
commit a15675efc3
2 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.1)
project(CompileFeatures)
@ -31,7 +31,7 @@ foreach(feature ${cxx_features})
run_test(${feature} CXX)
endforeach()
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
# The cxx_alignof feature happens to work (for *this* testcase) with
# GNU 4.7, but it is first documented as available with GNU 4.8.
@ -39,7 +39,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
cxx_alignof
)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
# GNU prior to 4.9 does not set any preprocessor define to distinguish
# c++1y from c++11, so CMake does not support c++1y features before GNU 4.9.

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 3.1.0)
project(WriteCompilerDetectionHeader)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -56,17 +56,17 @@ macro(set_defines target true_defs false_defs)
)
endmacro()
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
OR CMAKE_CXX_COMPILER_ID STREQUAL Clang
OR CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# False for C++98 mode.
list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
endif()
if (CMAKE_C_COMPILER_ID STREQUAL GNU
OR CMAKE_C_COMPILER_ID STREQUAL Clang
OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU"
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
add_executable(C_undefined c_undefined.c)
set_property(TARGET C_undefined PROPERTY CXX_STANDARD 90)
target_compile_options(C_undefined PRIVATE -Werror=undef)