Do not test the files config/testfiles/*.cpp while cross-compiling

This commit is contained in:
Laurent Rineau 2017-09-06 16:52:33 +02:00
parent 92a6f5ef71
commit 08676e21fa
1 changed files with 17 additions and 15 deletions

View File

@ -708,25 +708,27 @@ macro(add_config_flag flag)
endif()
endmacro()
file(GLOB all_config_tests "${CGAL_INSTALLATION_PACKAGE_DIR}/config/testfiles/*.cpp")
list(SORT all_config_tests)
if(NOT CMAKE_CROSSCOMPILING)
file(GLOB all_config_tests "${CGAL_INSTALLATION_PACKAGE_DIR}/config/testfiles/*.cpp")
list(SORT all_config_tests)
file(WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n")
file(WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n")
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)
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}.
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()
# 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()
add_config_flag(${config_test_name} ${config_test_name})
endforeach()
add_config_flag(${config_test_name} ${config_test_name})
endforeach()
endif()
add_config_flag(CGAL_USE_GMP)
add_config_flag(CGAL_USE_MPFR)