Features: Wrap failure-test in UNIX condition.

The use of GNU on non-UNIX for 'compile features' is not
tested and is not well defined.
This commit is contained in:
Stephen Kelly 2015-01-18 14:59:40 +01:00
parent 1ae2c6b2c9
commit 2a5ca650c9
1 changed files with 8 additions and 6 deletions

View File

@ -25,12 +25,14 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
) )
add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
include(CheckCXXSourceCompiles) if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" include(CheckCXXSourceCompiles)
file_include_works check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n"
) file_include_works
if (file_include_works) )
message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.") if (file_include_works)
message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.")
endif()
endif() endif()
return() return()
endif() endif()