Merge pull request #4111 from lrineau/CGAL-fix_ctest_on_Windows-GF

Fix CTest on windows
This commit is contained in:
Laurent Rineau 2019-09-05 14:59:38 +02:00
commit 2a5b7cd7ba
8 changed files with 53 additions and 8 deletions

View File

@ -156,6 +156,7 @@ function(cgal_arr_2_add_target exe_name source_file)
set(name ${exe_name}_${suffix}) set(name ${exe_name}_${suffix})
endif() endif()
add_executable(${name} ${source_file}) add_executable(${name} ${source_file})
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${name} )
separate_arguments(flags UNIX_COMMAND "${TESTSUITE_CXXFLAGS}") separate_arguments(flags UNIX_COMMAND "${TESTSUITE_CXXFLAGS}")
target_compile_options(${name} PRIVATE ${flags}) target_compile_options(${name} PRIVATE ${flags})
cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}") cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}")

View File

@ -957,12 +957,17 @@ endif()
# #
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
if(NOT TARGET ALL_CGAL_TARGETS)
add_custom_target( ALL_CGAL_TARGETS )
endif()
macro( add_programs subdir target ON_OFF ) macro( add_programs subdir target ON_OFF )
cache_set( CGAL_EXECUTABLE_TARGETS "" ) cache_set( CGAL_EXECUTABLE_TARGETS "" )
add_custom_target( ${target} ) add_custom_target( ${target} )
add_dependencies( ALL_CGAL_TARGETS ${target} )
option( WITH_${target} "Select ${target}" ${ON_OFF} ) option( WITH_${target} "Select ${target}" ${ON_OFF} )
if ( WITH_${target} ) if ( WITH_${target} )
add_subdirectory( ${subdir} EXCLUDE_FROM_ALL ) add_subdirectory( ${subdir} EXCLUDE_FROM_ALL )

View File

@ -98,8 +98,12 @@ function(cgal_add_compilation_test 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}")
set_property(TEST "compilation_of__${exe_name}" set_property(TEST "compilation_of__${exe_name}"
APPEND PROPERTY LABELS "${PROJECT_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) if(NOT TARGET cgal_check_build_system)
add_custom_target(cgal_check_build_system) add_custom_target(cgal_check_build_system)
add_dependencies( ALL_CGAL_TARGETS cgal_check_build_system )
endif() endif()
if(NOT TEST check_build_system) if(NOT TEST check_build_system)
add_test(NAME "check_build_system" add_test(NAME "check_build_system"

View File

@ -9,7 +9,7 @@
get_property(PROPERTY_CGAL_run_at_the_end_of_configuration_INCLUDED get_property(PROPERTY_CGAL_run_at_the_end_of_configuration_INCLUDED
GLOBAL 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() return()
endif() endif()
@ -17,11 +17,38 @@ function(CGAL_run_at_the_end_of_configuration variable access value current_list
if(NOT access STREQUAL "MODIFIED_ACCESS") if(NOT access STREQUAL "MODIFIED_ACCESS")
return() return()
endif() endif()
if(CGAL_CHECK_UNUSED_CPP_FILES 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)
file(GLOB _cppfiles ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file(GLOB _cppfiles ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_property(_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
if(_targets AND _cppfiles) if(_targets AND _cppfiles)
set(_sources) set(_sources)
foreach(_target ${_targets}) foreach(_target ${_targets})

View File

@ -72,7 +72,10 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
# CMakeLists.txt can be the target like if it was an imported # CMakeLists.txt can be the target like if it was an imported
# target. # target.
add_library(CGAL::${LIBRARY_NAME} ALIAS ${LIBRARY_NAME}) 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(CGAL_AUTO_LINK_ENABLED)
if (NOT CGAL_HEADER_ONLY) if (NOT CGAL_HEADER_ONLY)
set_target_properties( ${LIBRARY_NAME} PROPERTIES set_target_properties( ${LIBRARY_NAME} PROPERTIES

View File

@ -23,7 +23,9 @@ macro(create_link_to_program COMPONENT )
else() else()
target_link_libraries(link_to_${COMPONENT} CGAL::${COMPONENT} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} ) target_link_libraries(link_to_${COMPONENT} CGAL::${COMPONENT} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} )
endif() endif()
add_to_cached_list( CGAL_EXECUTABLE_TARGETS link_to_${COMPONENT} )
endmacro() endmacro()
find_package(CGAL QUIET COMPONENTS Core) find_package(CGAL QUIET COMPONENTS Core)
@ -82,6 +84,7 @@ if ( CGAL_FOUND )
add_executable(test_gmp_mpfr_dll test_gmp_mpfr_dll.cpp) add_executable(test_gmp_mpfr_dll test_gmp_mpfr_dll.cpp)
target_link_libraries(test_gmp_mpfr_dll version) target_link_libraries(test_gmp_mpfr_dll version)
CGAL_add_test(test_gmp_mpfr_dll) CGAL_add_test(test_gmp_mpfr_dll)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS test_gmp_mpfr_dll )
endif() endif()
find_package( LEDA QUIET) find_package( LEDA QUIET)

View File

@ -94,6 +94,7 @@ if ( CGAL_FOUND )
add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp )
target_link_libraries( mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) target_link_libraries( mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES})
cgal_add_test( mesh_3D_gray_vtk_image ) cgal_add_test( mesh_3D_gray_vtk_image )
add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image )
endif() endif()
create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) create_single_source_cgal_program( "mesh_3D_gray_image.cpp" )

View File

@ -230,6 +230,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
PUBLIC demo_framework ${CGAL_LIBRARIES} PUBLIC demo_framework ${CGAL_LIBRARIES}
Qt5::OpenGL Qt5::Gui Qt5::Script Qt5::Widgets) Qt5::OpenGL Qt5::Gui Qt5::Script Qt5::Widgets)
cgal_add_compilation_test(${item_name}) cgal_add_compilation_test(${item_name})
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${item_name} )
endmacro(add_item) endmacro(add_item)
add_item(scene_c3t3_item Scene_c3t3_item.cpp) add_item(scene_c3t3_item Scene_c3t3_item.cpp)