remove CMP code now that we only support from cmake 3.13

This commit is contained in:
Maxime Gimeno 2020-10-08 11:50:22 +02:00
parent 733c487cc2
commit 221bbdd4b1
7 changed files with 33 additions and 58 deletions

View File

@ -1131,7 +1131,7 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include)
set(check_pkg_headers_depends "") set(check_pkg_headers_depends "")
# Then recurse2 # Then recurse2
file(GLOB_RECURSE ${package}_HEADERS file(GLOB_RECURSE ${package}_HEADERS #don't use a hard coded list because the ones for the documented headers is enough.
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include" RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/CGAL/*.h*") "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/CGAL/*.h*")
list(SORT ${package}_HEADERS) list(SORT ${package}_HEADERS)

View File

@ -57,13 +57,10 @@ function(create_single_source_cgal_program firstfile )
set(NO_TESTING TRUE) set(NO_TESTING TRUE)
endif() endif()
if(POLICY CMP0064) if(NOT NO_TESTING)
# CMake 3.4 or later cgal_add_test(${exe_name})
if(NOT NO_TESTING) else()
cgal_add_test(${exe_name}) cgal_add_test(${exe_name} NO_EXECUTION)
else()
cgal_add_test(${exe_name} NO_EXECUTION)
endif()
endif() endif()
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )

View File

@ -25,9 +25,7 @@
# Boost versions, even if the file FindBoost.cmake is old. # Boost versions, even if the file FindBoost.cmake is old.
if( NOT CGAL_TweakFindBoost ) if( NOT CGAL_TweakFindBoost )
if(POLICY CMP0077) cmake_policy(SET CMP0077 NEW)
cmake_policy(SET CMP0077 NEW)
endif()
if(DEFINED CGAL_Boost_USE_STATIC_LIBS) if(DEFINED CGAL_Boost_USE_STATIC_LIBS)
# If the option is loaded from CGALConfig.cmake, use its value as default # If the option is loaded from CGALConfig.cmake, use its value as default
# value. But the user will still have the choice to change the # value. But the user will still have the choice to change the
@ -60,7 +58,7 @@ if( NOT CGAL_TweakFindBoost )
list(APPEND CGAL_3RD_PARTY_DEFINITIONS -DBOOST_ALL_DYN_LINK) list(APPEND CGAL_3RD_PARTY_DEFINITIONS -DBOOST_ALL_DYN_LINK)
set(CGAL_3RD_PARTY_DEFINITIONS "${CGAL_3RD_PARTY_DEFINITIONS}" set(CGAL_3RD_PARTY_DEFINITIONS "${CGAL_3RD_PARTY_DEFINITIONS}"
CACHE INTERNAL "3rd party definitions for CGAL") CACHE INTERNAL "3rd party definitions for CGAL")
endif() endif()
endif() endif()

View File

@ -5,25 +5,6 @@ set(CGAL_add_test_included TRUE)
option(BUILD_TESTING "Build the testing tree." OFF) option(BUILD_TESTING "Build the testing tree." OFF)
if(NOT POLICY CMP0064)
# CMake <= 3.3
if(BUILD_TESTING)
message(WARNING
"CGAL CTest support requires CMake 3.4 or later.\n"
"You must either disable BUILD_TESTING or upgrade CMake.")
endif()
# Add a fake function to avoid CMake errors
function(cgal_add_compilation_test)
endfunction()
# Add a fake function to avoid CMake errors
function(cgal_setup_test_properties)
endfunction()
# Then return, to exit the file
return()
endif()
if(BUILD_TESTING) if(BUILD_TESTING)
enable_testing() enable_testing()
endif() endif()
@ -94,7 +75,7 @@ function(expand_list_with_globbing list_name)
endfunction() endfunction()
function(cgal_add_compilation_test exe_name) function(cgal_add_compilation_test exe_name)
if(NOT POLICY CMP0064 OR TEST compilation_of__${exe_name}) if(TEST compilation_of__${exe_name})
return() return()
endif() endif()
add_test(NAME "compilation_of__${exe_name}" add_test(NAME "compilation_of__${exe_name}"
@ -111,15 +92,11 @@ function(cgal_add_compilation_test exe_name)
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "cgal_check_build_system" --config "$<CONFIG>") COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "cgal_check_build_system" --config "$<CONFIG>")
set_property(TEST "check_build_system" set_property(TEST "check_build_system"
APPEND PROPERTY LABELS "${PROJECT_NAME}") APPEND PROPERTY LABELS "${PROJECT_NAME}")
if(POLICY CMP0066) # cmake 3.7 or later set_property(TEST "check_build_system"
set_property(TEST "check_build_system" PROPERTY FIXTURES_SETUP "check_build_system_SetupFixture")
PROPERTY FIXTURES_SETUP "check_build_system_SetupFixture")
endif()
endif()
if(POLICY CMP0066) # cmake 3.7 or later
set_property(TEST "compilation_of__${exe_name}"
APPEND PROPERTY FIXTURES_REQUIRED "check_build_system_SetupFixture")
endif() endif()
set_property(TEST "compilation_of__${exe_name}"
APPEND PROPERTY FIXTURES_REQUIRED "check_build_system_SetupFixture")
endfunction(cgal_add_compilation_test) endfunction(cgal_add_compilation_test)
option(CGAL_TEST_DRAW_FUNCTIONS "If set, the ctest command will not skip the tests of the draw functions.") option(CGAL_TEST_DRAW_FUNCTIONS "If set, the ctest command will not skip the tests of the draw functions.")
@ -147,8 +124,7 @@ function(cgal_setup_test_properties test_name)
get_filename_component(_binary_dir_abs ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE) get_filename_component(_binary_dir_abs ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
string(FIND "${_binary_dir_abs}" "${_source_dir_abs}" _search_binary_in_source) string(FIND "${_binary_dir_abs}" "${_source_dir_abs}" _search_binary_in_source)
if(_search_binary_in_source EQUAL "-1" if(_search_binary_in_source EQUAL "-1")
AND POLICY CMP0066) # CMake 3.7 or later
if(NOT TEST ${PROJECT_NAME}_SetupFixture) if(NOT TEST ${PROJECT_NAME}_SetupFixture)
if(ANDROID) if(ANDROID)
add_test(NAME ${PROJECT_NAME}_SetupFixture add_test(NAME ${PROJECT_NAME}_SetupFixture
@ -260,7 +236,7 @@ function(cgal_add_test exe_name)
set(test_name "execution___of__${exe_name}") set(test_name "execution___of__${exe_name}")
endif() endif()
# message(" test_name: ${test_name}") # message(" test_name: ${test_name}")
if(cgal_add_test_NO_EXECUTION OR NOT POLICY CMP0064 OR TEST ${test_name}) if(cgal_add_test_NO_EXECUTION OR TEST ${test_name})
return() return()
endif() endif()
# message("Add test ${test_name}") # message("Add test ${test_name}")
@ -303,11 +279,11 @@ function(cgal_add_test exe_name)
set(ARGS) set(ARGS)
# message(STATUS "DEBUG test ${exe_name}") # message(STATUS "DEBUG test ${exe_name}")
foreach(CMD_LINE ${CMD_LINES}) foreach(CMD_LINE ${CMD_LINES})
# message(STATUS " command line: ${CMD_LINE}") # message(STATUS " command line: ${CMD_LINE}")
string(REGEX REPLACE "\#.*" "" CMD_LINE "${CMD_LINE}") string(REGEX REPLACE "\#.*" "" CMD_LINE "${CMD_LINE}")
separate_arguments(CMD_LINE_ARGS UNIX_COMMAND ${CMD_LINE}) separate_arguments(CMD_LINE_ARGS UNIX_COMMAND ${CMD_LINE})
# message(STATUS " args: ${CMD_LINE_ARGS}") # message(STATUS " args: ${CMD_LINE_ARGS}")
list(APPEND ARGS ${CMD_LINE_ARGS}) list(APPEND ARGS ${CMD_LINE_ARGS})
endforeach() endforeach()
expand_list_with_globbing(ARGS) expand_list_with_globbing(ARGS)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}

View File

@ -34,4 +34,4 @@ set(list_of_whitelisted_headers_txt [=[
]=]) ]=])
separate_arguments(example_files UNIX_COMMAND ${list_of_whitelisted_headers_txt}) separate_arguments(list_of_whitelisted_headers UNIX_COMMAND ${list_of_whitelisted_headers_txt})

View File

@ -20,6 +20,8 @@ SET(WITH_NTL OFF CACHE BOOL "")
SET(WITH_demos ON CACHE BOOL "") SET(WITH_demos ON CACHE BOOL "")
SET(CGAL_HEADER_ONLY ON CACHE BOOL "")
SET(Boost_DIR "C:\\3rdPartyLibs\\boost_master\\install_dir\\lib\\cmake\\Boost-1.71.0" CACHE PATH "") SET(Boost_DIR "C:\\3rdPartyLibs\\boost_master\\install_dir\\lib\\cmake\\Boost-1.71.0" CACHE PATH "")
SET(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "") SET(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "")

View File

@ -21,3 +21,5 @@ SET(WITH_MPFR ON CACHE BOOL "")
SET(WITH_NTL OFF CACHE BOOL "") SET(WITH_NTL OFF CACHE BOOL "")
SET(WITH_demos ON CACHE BOOL "") SET(WITH_demos ON CACHE BOOL "")
SET(CGAL_HEADER_ONLY ON CACHE BOOL "")