Always run the config tests

The code tried to prevent running the config tests to often by caching
their values and only rerunning them when the CMAKE_CXX_FLAGS change.

While this is smart it only buys us a few seconds and is not actually
correct. One of those bugs could be triggered through linker flags or
debug flags as well and just checking CMAKE_CXX_FLAGS is far from
enough. To be on the safe side we accept the extra
configuration-time (which is usually also minimized by using compiler
caches).

This also removes a warning caused by CMake policy CMP0054.
This commit is contained in:
Philipp Möller 2015-08-05 14:17:25 +02:00
parent 8e5f887765
commit de403e8cc4
1 changed files with 10 additions and 17 deletions

View File

@ -669,25 +669,18 @@ file( WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_
cache_get(CONFIG_CXX_FLAGS)
foreach(config_test_cpp ${all_config_tests})
# Test's name is .cpp's base name
get_filename_component(config_test_name ${config_test_cpp} NAME_WE)
# Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}.
if( RUNNING_CGAL_AUTO_TEST OR "${config_test_name}" MATCHES "^${config_test_name}$" OR NOT ${CONFIG_CXX_FLAGS} STREQUAL ${CMAKE_CXX_FLAGS})
# Test's name is .cpp's base name
get_filename_component(config_test_name ${config_test_cpp} NAME_WE)
CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name})
# Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}.
CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name})
if(${config_test_name})
set(${config_test_name} 0)
else()
set(${config_test_name} 1)
endif()
if ( ${config_test_name} )
cache_set ( ${config_test_name} 0 )
else()
cache_set ( ${config_test_name} 1 )
endif()
endif()
add_config_flag( ${config_test_name} ${config_test_name} )
add_config_flag(${config_test_name} ${config_test_name})
endforeach()
cache_set(CONFIG_CXX_FLAGS ${CMAKE_CXX_FLAGS})