diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index b6b7c44bd52..c5a7fc5b4ec 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -69,6 +69,9 @@ function(create_single_source_cgal_program firstfile ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) target_link_libraries(${exe_name} PRIVATE CGAL::CGAL) + foreach(comp ${CGAL_REQUESTED_COMPONENTS}) + target_link_libraries(${exe_name} PRIVATE CGAL::CGAL_${comp}) + endforeach() if(CGAL_3RD_PARTY_LIBRARIES) target_link_libraries(${exe_name} PRIVATE ${CGAL_3RD_PARTY_LIBRARIES}) endif() diff --git a/Scripts/scripts/cgal_create_CMakeLists b/Scripts/scripts/cgal_create_CMakeLists index 63453a6d5f8..05324bc4f53 100755 --- a/Scripts/scripts/cgal_create_CMakeLists +++ b/Scripts/scripts/cgal_create_CMakeLists @@ -468,11 +468,10 @@ EOF echo echo "# Link the executable to CGAL and third-party libraries" LIBS="" - if [ "$qt4" = "y" ]; then - LIBS="\${QT_LIBRARIES}" - fi - LIBS=$LIBS" \${CGAL_LIBRARIES} \${CGAL_3RD_PARTY_LIBRARIES}" - echo "target_link_libraries(${target_name} $LIBS )" + for comp in ${CGAL_COMPONENTS}; do + LIBS=$LIBS" CGAL::CGAL_${comp}" + done + echo "target_link_libraries(${target_name} PRIVATE CGAL::CGAL${LIBS} )" fi # single source or all files #===========================================