Updates for ctest with visual generator

This commit is contained in:
Maxime Gimeno 2019-08-16 12:22:11 +02:00
parent a4b171d77f
commit 3513016dcf
8 changed files with 89 additions and 5 deletions

View File

@ -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}")

View File

@ -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()

View File

@ -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} )

View File

@ -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 "$<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 "$<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")

View File

@ -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")

View File

@ -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

View File

@ -24,6 +24,8 @@ macro(create_link_to_program COMPONENT )
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)

View File

@ -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)