Try to fix link issues with qt6 resources (#7915)

This commit is contained in:
Sebastien Loriot 2024-01-19 11:42:11 +01:00 committed by GitHub
commit 2e4139cbb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 23 deletions

View File

@ -57,12 +57,6 @@ function(create_single_source_cgal_program firstfile )
set(NO_TESTING TRUE) set(NO_TESTING TRUE)
endif() endif()
if(NOT NO_TESTING)
cgal_add_test(${exe_name})
else()
cgal_add_test(${exe_name} NO_EXECUTION)
endif()
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )
target_link_libraries(${exe_name} PRIVATE CGAL::CGAL CGAL::Data) target_link_libraries(${exe_name} PRIVATE CGAL::CGAL CGAL::Data)
@ -75,13 +69,10 @@ function(create_single_source_cgal_program firstfile )
target_link_libraries(${exe_name} PRIVATE ${CGAL_3RD_PARTY_LIBRARIES}) target_link_libraries(${exe_name} PRIVATE ${CGAL_3RD_PARTY_LIBRARIES})
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()
else() else()

View File

@ -117,16 +117,15 @@ function(cgal_add_compilation_test exe_name)
add_test(NAME "check build system" add_test(NAME "check build system"
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 "CGAL_build_system") APPEND PROPERTY LABELS "CGAL_build_system" "Installation")
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(TARGET CGAL_Qt6_moc_and_resources) # if CGAL_Qt6 was searched, and is header-only if(TARGET CGAL_Qt6_moc_and_resources) # if CGAL_Qt6 was searched, and is header-only
get_property(linked_libraries TARGET "${exe_name}" PROPERTY LINK_LIBRARIES) get_property(linked_libraries TARGET "${exe_name}" PROPERTY LINK_LIBRARIES)
# message(STATUS "${exe_name} depends on ${linked_libraries}") # message(STATUS "${exe_name} depends on ${linked_libraries}")
string(FIND "${linked_libraries}" "CGAL::CGAL_Qt6" link_with_CGAL_Qt6) if( ("CGAL_Qt6" IN_LIST linked_libraries OR "CGAL::CGAL_Qt6" IN_LIST linked_libraries OR "CGAL::CGAL_Basic_viewer" IN_LIST linked_libraries)
if(link_with_CGAL_Qt6 STRGREATER "-1" AND AND NOT TARGET "compilation_of__CGAL_Qt6_moc_and_resources")
NOT TARGET "compilation_of__CGAL_Qt6_moc_and_resources")
# This custom target is useless. It is used only as a flag to # This custom target is useless. It is used only as a flag to
# detect that the test has already been created. # detect that the test has already been created.
add_custom_target("compilation_of__CGAL_Qt6_moc_and_resources") add_custom_target("compilation_of__CGAL_Qt6_moc_and_resources")
@ -134,7 +133,7 @@ function(cgal_add_compilation_test exe_name)
add_test(NAME "compilation of CGAL_Qt6_moc_and_resources" add_test(NAME "compilation of CGAL_Qt6_moc_and_resources"
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "CGAL_Qt6_moc_and_resources" --config "$<CONFIG>") COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "CGAL_Qt6_moc_and_resources" --config "$<CONFIG>")
set_property(TEST "compilation of CGAL_Qt6_moc_and_resources" set_property(TEST "compilation of CGAL_Qt6_moc_and_resources"
APPEND PROPERTY LABELS "CGAL_build_system") APPEND PROPERTY LABELS "CGAL_build_system" "Installation")
set_property(TEST "compilation of CGAL_Qt6_moc_and_resources" set_property(TEST "compilation of CGAL_Qt6_moc_and_resources"
PROPERTY FIXTURES_SETUP "CGAL_Qt6_moc_and_resources_Fixture") PROPERTY FIXTURES_SETUP "CGAL_Qt6_moc_and_resources_Fixture")
set_property(TEST "compilation of CGAL_Qt6_moc_and_resources" set_property(TEST "compilation of CGAL_Qt6_moc_and_resources"

View File

@ -110,7 +110,7 @@ function(CGAL_hook_fix_ctest_depending_on_Qt6)
continue() continue()
endif() endif()
get_property(_target_links TARGET ${_target} PROPERTY LINK_LIBRARIES) get_property(_target_links TARGET ${_target} PROPERTY LINK_LIBRARIES)
if("CGAL_Qt6" IN_LIST _target_links OR "CGAL::CGAL_Qt6" IN_LIST _target_links) if("CGAL_Qt6" IN_LIST _target_links OR "CGAL::CGAL_Qt6" IN_LIST _target_links OR "CGAL::CGAL_Basic_viewer" IN_LIST _target_links)
set_property(TEST "compilation of ${_target}" APPEND PROPERTY FIXTURES_REQUIRED CGAL_Qt6_moc_and_resources_Fixture) set_property(TEST "compilation of ${_target}" APPEND PROPERTY FIXTURES_REQUIRED CGAL_Qt6_moc_and_resources_Fixture)
endif() endif()
endforeach() endforeach()

View File

@ -45,11 +45,11 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "demo_framework" --config "$<CONFIG>") COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "demo_framework" --config "$<CONFIG>")
set_property(TEST "compilation of demo_framework" set_property(TEST "compilation of demo_framework"
APPEND PROPERTY LABELS "CGAL_build_system") APPEND PROPERTY LABELS "CGAL_build_system" "Installation" "${PROJECT_NAME}")
set_property(TEST "compilation of demo_framework" set_property(TEST "compilation of demo_framework"
APPEND PROPERTY FIXTURES_SETUP "demo_framework_SetupFixture") APPEND PROPERTY FIXTURES_SETUP "demo_framework_SetupFixture")
set_property(TEST "compilation of demo_framework" set_property(TEST "compilation of demo_framework"
APPEND PROPERTY DEPENDS "compilation_of__CGAL_Qt6_moc_and_resources") APPEND PROPERTY DEPENDS "check build system" "compilation of CGAL_Qt6_moc_and_resources")
endif() endif()
endif() endif()
else() else()
@ -61,7 +61,7 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
endif() endif()
# Link with CGAL # Link with CGAL
target_link_libraries( ${plugin_name} PUBLIC CGAL::CGAL ) target_link_libraries( ${plugin_name} PUBLIC CGAL::CGAL )
if(TARGET Polyhedron_3) if(NOT CGAL_TEST_SUITE AND TARGET Polyhedron_3)
add_dependencies( ${plugin_name} Polyhedron_3 ) add_dependencies( ${plugin_name} Polyhedron_3 )
endif() endif()
if(NOT TARGET CGALlab_all_plugins) if(NOT TARGET CGALlab_all_plugins)