Tests: Execute compile features tests unconditionally.
Conditionally create a dummy test if there are no known features.
This commit is contained in:
parent
597bb72ed7
commit
447fbb3fac
|
@ -1,6 +1,14 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(target_compile_features)
|
project(target_compile_features)
|
||||||
|
|
||||||
|
if (NOT CMAKE_CXX_COMPILE_FEATURES)
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_dummy.cpp"
|
||||||
|
"int main(int,char**) { return 0; }\n"
|
||||||
|
)
|
||||||
|
add_executable(target_compile_features "${CMAKE_CURRENT_BINARY_DIR}/test_dummy.cpp")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
|
||||||
add_executable(target_compile_features main.cpp)
|
add_executable(target_compile_features main.cpp)
|
||||||
|
|
|
@ -197,11 +197,9 @@ if(BUILD_TESTING)
|
||||||
ADD_TEST_MACRO(TarTest TarTest)
|
ADD_TEST_MACRO(TarTest TarTest)
|
||||||
ADD_TEST_MACRO(SystemInformation SystemInformation)
|
ADD_TEST_MACRO(SystemInformation SystemInformation)
|
||||||
ADD_TEST_MACRO(MathTest MathTest)
|
ADD_TEST_MACRO(MathTest MathTest)
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
|
|
||||||
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
|
||||||
ADD_TEST_MACRO(CompileFeatures CompileFeatures)
|
ADD_TEST_MACRO(CompileFeatures CompileFeatures)
|
||||||
ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
|
ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
|
||||||
endif()
|
|
||||||
# assume no resources building to test
|
# assume no resources building to test
|
||||||
set(TEST_RESOURCES FALSE)
|
set(TEST_RESOURCES FALSE)
|
||||||
# for windows and cygwin assume we have resources
|
# for windows and cygwin assume we have resources
|
||||||
|
|
|
@ -3,6 +3,14 @@ cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
project(CompileFeatures)
|
project(CompileFeatures)
|
||||||
|
|
||||||
|
if (NOT CMAKE_CXX_COMPILE_FEATURES)
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
|
||||||
|
"int main(int,char**) { return 0; }\n"
|
||||||
|
)
|
||||||
|
add_executable(CompileFeatures "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(run_test feature)
|
macro(run_test feature)
|
||||||
if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ${feature})
|
if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ${feature})
|
||||||
add_library(test_${feature} OBJECT ${feature}.cpp)
|
add_library(test_${feature} OBJECT ${feature}.cpp)
|
||||||
|
|
Loading…
Reference in New Issue