diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 3d1c81422e4..59490f24b0b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -152,6 +152,7 @@ function(cgal_arr_2_add_target exe_name source_file) set(name ${exe_name}_${suffix}) endif() add_executable(${name} ${source_file}) + add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${name} ) separate_arguments(flags UNIX_COMMAND "${TESTSUITE_CXXFLAGS}") target_compile_options(${name} PRIVATE ${flags}) cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}") diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt new file mode 100644 index 00000000000..891a5b6d017 --- /dev/null +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt @@ -0,0 +1,35 @@ + +cmake_minimum_required(VERSION 3.1...3.15) +project (Hyperbolic_triangulation_2_Demo) + +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) + +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + +find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core Qt5) +find_package(LEDA QUIET) + +find_package(Qt5 QUIET COMPONENTS Widgets) + +include_directories (BEFORE include) + +if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND (CGAL_Core_FOUND OR LEDA_FOUND)) + # ui files, created with Qt Designer + qt5_wrap_ui( UIS HDT2.ui ) + + # qrc files (resources files, that contain icons, at least) + qt5_add_resources ( RESOURCE_FILES resources/Delaunay_triangulation_2.qrc ) + + # cpp files + add_executable ( HDT2 HDT2.cpp ${CGAL_Qt5_RESOURCE_FILES} ${RESOURCE_FILES} ${UIS}) + add_to_cached_list( CGAL_EXECUTABLE_TARGETS HDT2 ) + target_link_libraries ( HDT2 CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Core Qt5::Widgets) +else() + message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core (or LEDA), and Qt5 and will not be compiled.") +endif() diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 70d6cae5330..a88af9b16c4 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -950,11 +950,16 @@ endif() # #-------------------------------------------------------------------------------------------------- +if(NOT TARGET ALL_CGAL_TARGETS) + add_custom_target( ALL_CGAL_TARGETS ) +endif() + macro( add_programs subdir target ON_OFF ) cache_set( CGAL_EXECUTABLE_TARGETS "" ) add_custom_target( ${target} ) + add_dependencies( ALL_CGAL_TARGETS ${target} ) option( WITH_${target} "Select ${target}" ${ON_OFF} ) if ( WITH_${target} ) diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index d1f30fcec3a..251a5e27275 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -86,15 +86,21 @@ function(cgal_add_compilation_test exe_name) return() endif() add_test(NAME "compilation_of__${exe_name}" - COMMAND ${TIME_COMMAND} "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "${exe_name}") + COMMAND ${TIME_COMMAND} "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "${exe_name}" --config "$") set_property(TEST "compilation_of__${exe_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") + if(NOT TARGET ALL_CGAL_TARGETS) + add_custom_target( ALL_CGAL_TARGETS ) + endif() if(NOT TARGET cgal_check_build_system) add_custom_target(cgal_check_build_system) + add_dependencies( ALL_CGAL_TARGETS cgal_check_build_system ) endif() if(NOT TEST check_build_system) add_test(NAME "check_build_system" - COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "cgal_check_build_system") + COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "cgal_check_build_system" --config "$") + set_property(TEST "check_build_system" + APPEND PROPERTY LABELS "Installation") if(POLICY CMP0066) # cmake 3.7 or later set_property(TEST "check_build_system" PROPERTY FIXTURES_SETUP "check_build_system_SetupFixture") diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake index 6f8e423af1d..ebd518c8ab0 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -9,7 +9,7 @@ get_property(PROPERTY_CGAL_run_at_the_end_of_configuration_INCLUDED GLOBAL PROPERTY CGAL_run_at_the_end_of_configuration_INCLUDED) -if(PROPERTY_CGAL_run_at_the_end_of_configuration_INCLUDED) +if(CGAL_SKIP_CMAKE_HOOKS OR PROPERTY_CGAL_run_at_the_end_of_configuration_INCLUDED) return() endif() @@ -17,6 +17,36 @@ function(CGAL_run_at_the_end_of_configuration variable access value current_list if(NOT access STREQUAL "MODIFIED_ACCESS") return() endif() + if(current_list_file STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" + AND NOT current_list_file STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" OR NOT stack STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" + AND stack STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") OR stack MATCHES doc/CMakeLists.txt + OR stack MATCHES demo/Polyhedron/) + return() + endif() + get_property(_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS) + if(CGAL_CHECK_UNREFERENCES_TARGETS) + set(_list_of_deps) + set(_special_targets demos examples tests ALL_CGAL_TARGETS CGAL_Qt5_moc_and_resources uninstall install_FindCGAL) + foreach(t ${_special_targets}) + if(NOT TARGET ${t}) + continue() + endif() + get_property(_deps TARGET ${t} PROPERTY MANUALLY_ADDED_DEPENDENCIES) + message(" deps of ${t}: ${_deps}") + list(APPEND _list_of_deps ${_deps}) + endforeach() + list(APPEND _list_of_deps ${CGAL_EXECUTABLE_TARGETS}) + message(STATUS " all deps: ${_list_of_deps}") + foreach(target ${_targets}) + message(STATUS " new target: ${target}") + if(${target} IN_LIST _special_targets) + continue() + endif() + if(NOT ${target} IN_LIST _list_of_deps) + message(AUTHOR_WARNING " orphan target: ${target}") + endif() + endforeach() + endif() if(CGAL_CHECK_UNUSED_CPP_FILES AND NOT current_list_file STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" AND stack STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") diff --git a/Installation/src/CMakeLists.txt b/Installation/src/CMakeLists.txt index caf995799b3..4cc0ae360e7 100644 --- a/Installation/src/CMakeLists.txt +++ b/Installation/src/CMakeLists.txt @@ -68,7 +68,10 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES) # CMakeLists.txt can be the target like if it was an imported # target. add_library(CGAL::${LIBRARY_NAME} ALIAS ${LIBRARY_NAME}) - + if(NOT TARGET ALL_CGAL_TARGETS) + add_custom_target( ALL_CGAL_TARGETS ) + endif() + add_dependencies( ALL_CGAL_TARGETS ${LIBRARY_NAME} ) if(CGAL_AUTO_LINK_ENABLED) if (NOT CGAL_HEADER_ONLY) set_target_properties( ${LIBRARY_NAME} PROPERTIES diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index 4727106e2e6..fb9093d880e 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -23,7 +23,9 @@ macro(create_link_to_program COMPONENT ) else() target_link_libraries(link_to_${COMPONENT} CGAL::${COMPONENT} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} ) endif() - + + add_to_cached_list( CGAL_EXECUTABLE_TARGETS link_to_${COMPONENT} ) + endmacro() find_package(CGAL QUIET COMPONENTS Core) @@ -85,6 +87,7 @@ if ( CGAL_FOUND ) add_executable(test_gmp_mpfr_dll test_gmp_mpfr_dll.cpp) target_link_libraries(test_gmp_mpfr_dll version) CGAL_add_test(test_gmp_mpfr_dll) + add_to_cached_list( CGAL_EXECUTABLE_TARGETS test_gmp_mpfr_dll ) endif() find_package( LEDA QUIET) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 3a42075d74f..1eb28efb128 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -232,6 +232,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) compilation_of__${item_name} PROPERTIES DEPENDS compilation__of_demo_framework) endif() + add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${item_name} ) endmacro(add_item) add_item(scene_c3t3_item Scene_c3t3_item.cpp)