diff --git a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt index 5ea12f55be3..9c066bd6cf4 100644 --- a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt @@ -8,15 +8,18 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) + include(CGAL_Eigen_support) # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) - if(NOT (${cppfile} STREQUAL "ellipsoid.cpp") OR EIGEN3_FOUND) - create_single_source_cgal_program( "${cppfile}" ) - if (EIGEN3_FOUND) - get_filename_component(target ${cppfile} NAME_WE) - CGAL_target_use_Eigen(${target}) + if(NOT (${cppfile} STREQUAL "ellipsoid.cpp") OR TARGET CGAL::Eigen_support) + get_filename_component(target ${cppfile} NAME_WE) + add_executable(${target} ${cppfile}) + if (TARGET CGAL::Eigen_support) + target_link_libraries(${target} CGAL::CGAL CGAL::Eigen_support) + else() + target_link_libraries(${target} CGAL::CGAL) endif() endif() endforeach() @@ -26,4 +29,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt index 804517aea26..5a29e19f887 100644 --- a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt +++ b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt @@ -14,15 +14,18 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) + include(CGAL_Eigen_support) # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) - if(NOT (${cppfile} STREQUAL "Approximate_min_ellipsoid_d.cpp") OR EIGEN3_FOUND) - create_single_source_cgal_program( "${cppfile}" ) - if (EIGEN3_FOUND) - get_filename_component(target ${cppfile} NAME_WE) - CGAL_target_use_Eigen(${target}) + if(NOT (${cppfile} STREQUAL "Approximate_min_ellipsoid_d.cpp") OR TARGET CGAL::Eigen_support) + get_filename_component(target ${cppfile} NAME_WE) + add_executable(${target} ${cppfile}) + if (TARGET CGAL::Eigen_support) + target_link_libraries(${target} CGAL::CGAL CGAL::Eigen_support) + else() + target_link_libraries(${target} CGAL::CGAL) endif() endif() endforeach() @@ -32,4 +35,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt index 6f4ec1704ce..de7955c4208 100644 --- a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt @@ -8,6 +8,7 @@ project( Box_intersection_d_Tests ) find_package( CGAL QUIET ) find_package( TBB ) +include(CGAL_TBB_support) if ( CGAL_FOUND ) @@ -16,12 +17,11 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "random_set_test.cpp" ) create_single_source_cgal_program( "test_box_grid.cpp" ) - if( TBB_FOUND ) - CGAL_target_use_TBB( test_box_grid ) + if(TARGET CGAL::TBB_support) + target_link_libraries(test_box_grid PUBLIC CGAL::TBB_support) else() message( STATUS "NOTICE: Intel TBB was not found. Sequential code will be used." ) endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt index 18e2f342352..6e6749d8619 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt @@ -27,7 +27,8 @@ if ( CGAL_FOUND ) include(${CGAL_USE_FILE}) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if (NOT EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (NOT TARGET CGAL::Eigen_support) message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.") return() endif() @@ -140,8 +141,7 @@ if ( CGAL_FOUND ) foreach(IPELET ${CGAL_IPELETS}) add_library(CGAL_${IPELET} MODULE ${IPELET}.cpp) add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_${IPELET}) - target_link_libraries(CGAL_${IPELET} PRIVATE CGAL::CGAL ${IPE_LIBRARIES}) - CGAL_target_use_Eigen(CGAL_${IPELET}) + target_link_libraries(CGAL_${IPELET} PRIVATE CGAL::CGAL CGAL::Eigen_support ${IPE_LIBRARIES}) if ( IPELET_INSTALL_DIR ) install(TARGETS CGAL_${IPELET} DESTINATION ${IPELET_INSTALL_DIR}) if (WITH_IPE_7) @@ -151,14 +151,12 @@ if ( CGAL_FOUND ) cgal_add_compilation_test(CGAL_${IPELET}) endforeach(IPELET) if(CGAL_Core_FOUND) - target_link_libraries(CGAL_cone_spanners PRIVATE CGAL::CGAL_Core) - CGAL_target_use_Eigen(CGAL_cone_spanners) + target_link_libraries(CGAL_cone_spanners PRIVATE CGAL::CGAL_Core CGAL::Eigen_support) endif() #example in doc not installed add_library(simple_triangulation MODULE simple_triangulation.cpp) add_to_cached_list(CGAL_EXECUTABLE_TARGETS simple_triangulation) - target_link_libraries(simple_triangulation ${IPE_LIBRARIES}) - CGAL_target_use_Eigen(simple_triangulation) + target_link_libraries(simple_triangulation CGAL::Eigen_support ${IPE_LIBRARIES}) cgal_add_compilation_test(simple_triangulation) else() diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index f2e1cf3ec61..4aea4f3ebc4 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -24,32 +24,39 @@ endif() set(Classification_dependencies_met TRUE) find_package( Boost OPTIONAL_COMPONENTS serialization iostreams ) -if (NOT Boost_SERIALIZATION_FOUND) +include(CGAL_Boost_serialization_support) +include(CGAL_Boost_iostreams_support) + +if (NOT TARGET CGAL::Boost_serialization_support) message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.") set(Classification_dependencies_met FALSE) endif() -if (NOT Boost_IOSTREAMS_FOUND) +if (NOT TARGET CGAL::Boost_iostreams_support) message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.") set(Classification_dependencies_met FALSE) endif() find_package(OpenCV QUIET COMPONENTS core ml) # Need core + machine learning -if (NOT OpenCV_FOUND) +include(CGAL_OpenCV_support) +if (NOT TARGET CGAL::OpenCV_support) message(STATUS "NOTICE: OpenCV was not found. OpenCV random forest predicate for classification won't be available.") endif() find_package(TensorFlow QUIET) -if (NOT TensorFlow_FOUND) +include(CGAL_TensorFlow_support) +if (NOT TARGET CGAL::TensorFlow_support) message(STATUS "NOTICE: TensorFlow was not found. TensorFlow neural network predicate for classification won't be available.") endif() find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") set(Classification_dependencies_met FALSE) endif() find_package(TBB QUIET) +include(CGAL_TBB_support) if (NOT Classification_dependencies_met) return() @@ -62,14 +69,14 @@ create_single_source_cgal_program( "example_generation_and_training.cpp" ) create_single_source_cgal_program( "example_mesh_classification.cpp" ) create_single_source_cgal_program( "example_cluster_classification.cpp" ) -if (OpenCV_FOUND) +if (TARGET CGAL::OpenCV_support) create_single_source_cgal_program( "example_opencv_random_forest.cpp" ) - CGAL_target_use_OpenCV(example_opencv_random_forest) + target_link_libraries(example_opencv_random_forest PUBLIC CGAL::OpenCV_support) endif() -if (TensorFlow_FOUND) +if (TARGET CGAL::TensorFlow_support) create_single_source_cgal_program( "example_tensorflow_neural_network.cpp" ) - CGAL_target_use_TensorFlow(example_tensorflow_neural_network) + target_link_libraries(example_opencv_random_forest PUBLIC CGAL::TensorFlow_support) endif() foreach(target @@ -82,12 +89,12 @@ foreach(target example_opencv_random_forest example_tensorflow_neural_network) if(TARGET ${target}) - CGAL_target_use_Eigen(${target}) - CGAL_target_use_Boost_IOStreams(${target}) - CGAL_target_use_Boost_Serialization(${target}) - if(TBB_FOUND) - CGAL_target_use_TBB(${target}) + target_link_libraries(${target} PUBLIC + CGAL::Eigen_support + CGAL::Boost_iostreams_support + CGAL::Boost_serialization_support) + if(TARGET CGAL::TBB_support) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) endif() endif() endforeach() - diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index 9dc6193801a..a93e0277355 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -24,17 +24,21 @@ endif() set(Classification_dependencies_met TRUE) find_package( Boost OPTIONAL_COMPONENTS serialization iostreams ) -if (NOT Boost_SERIALIZATION_FOUND) +include(CGAL_Boost_serialization_support) +include(CGAL_Boost_iostreams_support) + +if (NOT TARGET CGAL::Boost_serialization_support) message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.") set(Classification_dependencies_met FALSE) endif() -if (NOT Boost_IOSTREAMS_FOUND) +if (NOT TARGET CGAL::Boost_iostreams_support) message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.") set(Classification_dependencies_met FALSE) endif() find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") set(Classification_dependencies_met FALSE) endif() @@ -49,11 +53,11 @@ create_single_source_cgal_program( "test_classification_point_set.cpp" ) create_single_source_cgal_program( "test_classification_io.cpp" ) foreach(target test_classification_point_set test_classification_io) - CGAL_target_use_Eigen(${target}) - CGAL_target_use_Boost_IOStreams(${target}) - CGAL_target_use_Boost_Serialization(${target}) - if(TBB_FOUND) - CGAL_target_use_TBB(${target}) + target_link_libraries(${target} PUBLIC + CGAL::Eigen_support + CGAL::Boost_iostreams_support + CGAL::Boost_serialization_support) + if(TARGET CGAL::TBB_support) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) endif() endforeach() - diff --git a/Generator/examples/Generator/CMakeLists.txt b/Generator/examples/Generator/CMakeLists.txt index c5ac751d26c..fa8efe5d09a 100644 --- a/Generator/examples/Generator/CMakeLists.txt +++ b/Generator/examples/Generator/CMakeLists.txt @@ -12,17 +12,18 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) + include(CGAL_Eigen_support) # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) if(NOT (${cppfile} STREQUAL "random_points_in_tetrahedral_mesh_3.cpp") OR NOT (${cppfile} STREQUAL "random_points_on_tetrahedral_mesh_3.cpp") - OR EIGEN3_FOUND) + OR TARGET CGAL::Eigen_support) create_single_source_cgal_program( "${cppfile}" ) - if (EIGEN3_FOUND) + if (TARGET CGAL::Eigen_support) get_filename_component(target ${cppfile} NAME_WE) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endif() endif() endforeach() @@ -32,4 +33,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Generator/test/Generator/CMakeLists.txt b/Generator/test/Generator/CMakeLists.txt index 3f24895ab6a..a757803d15c 100644 --- a/Generator/test/Generator/CMakeLists.txt +++ b/Generator/test/Generator/CMakeLists.txt @@ -12,15 +12,16 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) + include(CGAL_Eigen_support) # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) - if(NOT (${cppfile} STREQUAL "generic_random_test.cpp") OR EIGEN3_FOUND) + if(NOT (${cppfile} STREQUAL "generic_random_test.cpp") OR TARGET CGAL::Eigen_support) create_single_source_cgal_program( "${cppfile}" ) - if (EIGEN3_FOUND) + if (TARGET CGAL::Eigen_support) get_filename_component(target ${cppfile} NAME_WE) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endif() endif() endforeach() @@ -30,4 +31,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 4ef96ffcf74..a38afceeedd 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -16,7 +16,8 @@ endif() find_package(CGAL COMPONENTS Qt5 Core) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.") return() endif() @@ -46,12 +47,11 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # The executable itself. add_executable ( Polygon_2 Polygon_2.cpp ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) - CGAL_target_use_Eigen(Polygon_2) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polygon_2 ) target_link_libraries( Polygon_2 PRIVATE - CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + CGAL::CGAL CGAL::CGAL_Qt5 CGAL::Eigen_support Qt5::Gui ) include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) cgal_add_compilation_test(Polygon_2) diff --git a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt index f9703071b81..0a29731a259 100644 --- a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt @@ -33,8 +33,9 @@ endif() find_package(Eigen3 3.3.0) +include(CGAL_Eigen_support) -if (NOT EIGEN3_FOUND) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library (3.3 or greater), and will not be compiled.") return() endif() @@ -51,10 +52,10 @@ include_directories( BEFORE include ) include( CGAL_CreateSingleSourceCGALProgram ) create_single_source_cgal_program( "heat_method.cpp" ) -CGAL_target_use_Eigen(heat_method) +target_link_libraries(heat_method PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "heat_method_polyhedron.cpp" ) -CGAL_target_use_Eigen(heat_method_polyhedron) +target_link_libraries(heat_method_polyhedron PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "heat_method_surface_mesh.cpp" ) -CGAL_target_use_Eigen(heat_method_surface_mesh) +target_link_libraries(heat_method_surface_mesh PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "heat_method_surface_mesh_direct.cpp" ) -CGAL_target_use_Eigen(heat_method_surface_mesh_direct) +target_link_libraries(heat_method_surface_mesh_direct PUBLIC CGAL::Eigen_support) diff --git a/Heat_method_3/test/Heat_method_3/CMakeLists.txt b/Heat_method_3/test/Heat_method_3/CMakeLists.txt index 7876d80a53b..9a86ed7236c 100644 --- a/Heat_method_3/test/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/test/Heat_method_3/CMakeLists.txt @@ -33,8 +33,9 @@ endif() find_package(Eigen3 3.3.0) +include(CGAL_Eigen_support) -if (NOT EIGEN3_FOUND) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library (3.3 or greater), and will not be compiled.") return() endif() @@ -49,8 +50,8 @@ include_directories( BEFORE include ) include( CGAL_CreateSingleSourceCGALProgram ) create_single_source_cgal_program( "heat_method_concept.cpp" ) -CGAL_target_use_Eigen(heat_method_concept) +target_link_libraries(heat_method_concept PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "heat_method_surface_mesh_test.cpp" ) -CGAL_target_use_Eigen(heat_method_surface_mesh_test) +target_link_libraries(heat_method_surface_mesh_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "heat_method_surface_mesh_direct_test.cpp" ) -CGAL_target_use_Eigen(heat_method_surface_mesh_direct_test) +target_link_libraries(heat_method_surface_mesh_direct_test PUBLIC CGAL::Eigen_support) diff --git a/Installation/cmake/modules/CGAL_target_use_Boost_IOStreams.cmake b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake similarity index 54% rename from Installation/cmake/modules/CGAL_target_use_Boost_IOStreams.cmake rename to Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake index d57f785d54f..49e5965662b 100644 --- a/Installation/cmake/modules/CGAL_target_use_Boost_IOStreams.cmake +++ b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake @@ -1,39 +1,38 @@ -if (CGAL_target_use_Boost_IOStreams_included) - return() -endif() -set(CGAL_target_use_Boost_IOStreams_included TRUE) - -function(CGAL_target_use_Boost_IOStreams target) +if(Boost_IOSTREAMS_FOUND AND NOT TARGET CGAL::Boost_iostreams_support) if( WIN32 ) - # to avoid a warning with old cmake + + # to avoid a warning with old cmake set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") find_package( Boost OPTIONAL_COMPONENTS bzip2 zlib) - else() - find_package(ZLIB QUIET) - endif() - - if(TARGET Boost::iostreams) - target_link_libraries(${target} PUBLIC Boost::iostreams) - else() - target_link_libraries(${target} PUBLIC ${Boost_IOSTREAMS_LIBRARY}) - endif() - - if( WIN32 ) if (Boost_ZLIB_FOUND AND Boost_BZIP2_FOUND) - target_link_libraries(${target} PUBLIC ${Boost_ZLIB_LIBRARY} ${Boost_BZIP2_LIBRARY}) + set(ZLIB_LIBS ${Boost_ZLIB_LIBRARY} ${Boost_BZIP2_LIBRARY}) else() message(STATUS "NOTICE: This project requires Boost ZLIB and Boost BZIP2, and will not be compiled.") return() endif() + else() + + find_package(ZLIB QUIET) if(ZLIB_FOUND) - target_link_libraries(${target} PUBLIC ZLIB::ZLIB) + set(ZLIB_LIBS ZLIB::ZLIB) else() message(STATUS "NOTICE: This project requires ZLIB, and will not be compiled.") return() endif() + endif() -endfunction() + if(TARGET Boost::iostreams) + set(Boost_LIB Boost::iostreams) + else() + set(Boost_LIB ${Boost_IOSTREAMS_LIBRARY}) + endif() + + add_library(CGAL::Boost_iostreams_support INTERFACE IMPORTED) + set_target_properties(CGAL::Boost_iostreams_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_BOOST_IOSTREAMS" + INTERFACE_LINK_LIBRARIES "${Boost_LIB};${ZLIB_LIBS}") +endif() diff --git a/Installation/cmake/modules/CGAL_Boost_serialization_support.cmake b/Installation/cmake/modules/CGAL_Boost_serialization_support.cmake new file mode 100644 index 00000000000..236fbb4bf0c --- /dev/null +++ b/Installation/cmake/modules/CGAL_Boost_serialization_support.cmake @@ -0,0 +1,12 @@ +if(Boost_SERIALIZATION_FOUND AND NOT TARGET CGAL::Boost_serialization_support) + if(TARGET Boost::serialization) + set(Boost_LIB Boost::serialization) + else() + set(Boost_LIB ${Boost_SERIALIZATION_LIBRARY}) + endif() + + add_library(CGAL::Boost_serialization_support INTERFACE IMPORTED) + set_target_properties(CGAL::Boost_serialization_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_BOOST_SERIALIZATION" + INTERFACE_LINK_LIBRARIES "${Boost_LIB}") +endif() diff --git a/Installation/cmake/modules/CGAL_Common.cmake b/Installation/cmake/modules/CGAL_Common.cmake index 786763eb01f..ed1fe54ad0c 100644 --- a/Installation/cmake/modules/CGAL_Common.cmake +++ b/Installation/cmake/modules/CGAL_Common.cmake @@ -23,7 +23,7 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) else() set( CMAKE_2_6_3_OR_ABOVE FALSE ) endif() - + if ( CGAL_BUILDING_LIBS ) option(BUILD_SHARED_LIBS "Build shared libraries" ON) set(CGAL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) @@ -34,7 +34,7 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) message( STATUS "Building static libraries" ) endif() endif() - + if ( WIN32 ) find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) if(CMAKE_UNAME) @@ -61,15 +61,4 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) # set use-file for Eigen3 (needed to have default solvers) set(EIGEN3_USE_FILE "UseEigen3") - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_Boost_IOStreams.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_Boost_Serialization.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_Eigen.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_GLPK.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_LASLIB.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_OpenCV.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_OpenGR.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_pointmatcher.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_SCIP.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TensorFlow.cmake) endif() diff --git a/Installation/cmake/modules/CGAL_Eigen_support.cmake b/Installation/cmake/modules/CGAL_Eigen_support.cmake index 31e5f22abf5..5039bd5871a 100644 --- a/Installation/cmake/modules/CGAL_Eigen_support.cmake +++ b/Installation/cmake/modules/CGAL_Eigen_support.cmake @@ -1,4 +1,4 @@ -if(Eigen_FOUND AND NOT TARGET CGAL::Eigen_support) +if(EIGEN3_FOUND AND NOT TARGET CGAL::Eigen_support) if(NOT TARGET Threads::Threads) find_package(Threads REQUIRED) endif() diff --git a/Installation/cmake/modules/CGAL_GLPK_support.cmake b/Installation/cmake/modules/CGAL_GLPK_support.cmake new file mode 100644 index 00000000000..391fdf6263f --- /dev/null +++ b/Installation/cmake/modules/CGAL_GLPK_support.cmake @@ -0,0 +1,7 @@ +if(GLPK_FOUND AND NOT TARGET CGAL::GLPK_support) + add_library(CGAL::GLPK_support INTERFACE IMPORTED) + set_target_properties(CGAL::GLPK_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_GLPK" + INTERFACE_INCLUDE_DIRECTORIES "${GLPK_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${GLPK_LIBRARIES}") +endif() diff --git a/Installation/cmake/modules/CGAL_OpenCV_support.cmake b/Installation/cmake/modules/CGAL_OpenCV_support.cmake new file mode 100644 index 00000000000..84b4e9dd34d --- /dev/null +++ b/Installation/cmake/modules/CGAL_OpenCV_support.cmake @@ -0,0 +1,7 @@ +if(OpenCV_FOUND AND NOT TARGET CGAL::OpenCV_support) + add_library(CGAL::OpenCV_support INTERFACE IMPORTED) + set_target_properties(CGAL::OpenCV_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_OPENCV" + INTERFACE_INCLUDE_DIRECTORIES "${OpenCV_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${OpenCV_LIBS}") +endif() diff --git a/Installation/cmake/modules/CGAL_SCIP_support.cmake b/Installation/cmake/modules/CGAL_SCIP_support.cmake new file mode 100644 index 00000000000..6035b6d64cd --- /dev/null +++ b/Installation/cmake/modules/CGAL_SCIP_support.cmake @@ -0,0 +1,7 @@ +if(SCIP_FOUND AND NOT TARGET CGAL::SCIP_support) + add_library(CGAL::SCIP_support INTERFACE IMPORTED) + set_target_properties(CGAL::SCIP_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_SCIP" + INTERFACE_INCLUDE_DIRECTORIES "${SCIP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${SCIP_LIBRARIES}") +endif() diff --git a/Installation/cmake/modules/CGAL_TBB_support.cmake b/Installation/cmake/modules/CGAL_TBB_support.cmake index e34882e949c..372f3208578 100644 --- a/Installation/cmake/modules/CGAL_TBB_support.cmake +++ b/Installation/cmake/modules/CGAL_TBB_support.cmake @@ -6,5 +6,5 @@ if(TBB_FOUND AND NOT TARGET CGAL::TBB_support) set_target_properties(CGAL::TBB_support PROPERTIES INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_TBB;NOMINMAX" INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "TBB:tbb;TBB:tbbmalloc;Threads::Threads") + INTERFACE_LINK_LIBRARIES "TBB::tbb;TBB::tbbmalloc;Threads::Threads") endif() diff --git a/Installation/cmake/modules/CGAL_TensorFlow_support.cmake b/Installation/cmake/modules/CGAL_TensorFlow_support.cmake new file mode 100644 index 00000000000..2a910c1257e --- /dev/null +++ b/Installation/cmake/modules/CGAL_TensorFlow_support.cmake @@ -0,0 +1,7 @@ +if(TensorFlow_FOUND AND NOT TARGET CGAL::TensorFlow_support) + add_library(CGAL::TensorFlow_support INTERFACE IMPORTED) + set_target_properties(CGAL::TensorFlow_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_TENSORFLOW" + INTERFACE_INCLUDE_DIRECTORIES "${TensorFlow_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${TensorFlow_LIBRARY}") +endif() diff --git a/Installation/cmake/modules/CGAL_target_use_Boost_Serialization.cmake b/Installation/cmake/modules/CGAL_target_use_Boost_Serialization.cmake deleted file mode 100644 index d6ae805efd8..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_Boost_Serialization.cmake +++ /dev/null @@ -1,14 +0,0 @@ -if (CGAL_target_use_Boost_Serialization_included) - return() -endif() -set(CGAL_target_use_Boost_Serialization_included TRUE) - -function(CGAL_target_use_Boost_Serialization target) - - if(TARGET Boost::serialization) - target_link_libraries(${target} PUBLIC Boost::serialization) - else() - target_link_libraries(${target} PUBLIC ${Boost_SERIALIZATION_LIBRARY}) - endif() - -endfunction() diff --git a/Installation/cmake/modules/CGAL_target_use_Eigen.cmake b/Installation/cmake/modules/CGAL_target_use_Eigen.cmake deleted file mode 100644 index 84f9f3be721..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_Eigen.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if (CGAL_target_use_Eigen_included) - return() -endif() -set(CGAL_target_use_Eigen_included TRUE) - -set( Eigen3_FIND_VERSION "3.1.0") -set(EIGEN3_USE_FILE "UseEigen3") - -function(CGAL_target_use_Eigen target) - target_include_directories(${target} PUBLIC ${EIGEN3_INCLUDE_DIR}) - target_compile_options( ${target} PUBLIC -DCGAL_EIGEN3_ENABLED) -endfunction() - diff --git a/Installation/cmake/modules/CGAL_target_use_GLPK.cmake b/Installation/cmake/modules/CGAL_target_use_GLPK.cmake deleted file mode 100644 index f19bd315b16..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_GLPK.cmake +++ /dev/null @@ -1,11 +0,0 @@ -if (CGAL_target_use_GLPK_included) - return() -endif() -set(CGAL_target_use_GLPK_included TRUE) - -function(CGAL_target_use_GLPK target) - target_include_directories(${target} PUBLIC ${GLPK_INCLUDE_DIR}) - target_compile_options(${target} PUBLIC -DCGAL_USE_GLPK) - target_link_libraries(${target} PUBLIC ${GLPK_LIBRARIES}) -endfunction() - diff --git a/Installation/cmake/modules/CGAL_target_use_LASLIB.cmake b/Installation/cmake/modules/CGAL_target_use_LASLIB.cmake deleted file mode 100644 index 65ad9084e5a..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_LASLIB.cmake +++ /dev/null @@ -1,11 +0,0 @@ -if (CGAL_target_use_LASLIB_included) - return() -endif() -set(CGAL_target_use_LASLIB_included TRUE) - -function(CGAL_target_use_LASLIB target) - target_include_directories(${target} PUBLIC ${LASLIB_INCLUDE_DIR}) - target_include_directories(${target} PUBLIC ${LASZIP_INCLUDE_DIR}) - target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_LASLIB) - target_link_libraries(${target} PUBLIC ${LASLIB_LIBRARIES}) -endfunction() diff --git a/Installation/cmake/modules/CGAL_target_use_OpenCV.cmake b/Installation/cmake/modules/CGAL_target_use_OpenCV.cmake deleted file mode 100644 index d378d50aead..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_OpenCV.cmake +++ /dev/null @@ -1,10 +0,0 @@ -if (CGAL_target_use_OpenCV_included) - return() -endif() -set(CGAL_target_use_OpenCV_included TRUE) - -function(CGAL_target_use_OpenCV target) - target_include_directories(${target} PUBLIC ${OpenCV_INCLUDE_DIRS}) - target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_OPENCV) - target_link_libraries(${target} PUBLIC ${OpenCV_LIBS}) -endfunction() diff --git a/Installation/cmake/modules/CGAL_target_use_OpenGR.cmake b/Installation/cmake/modules/CGAL_target_use_OpenGR.cmake deleted file mode 100644 index dc6044f8926..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_OpenGR.cmake +++ /dev/null @@ -1,9 +0,0 @@ -if (CGAL_target_use_OpenGR_included) - return() -endif() -set(CGAL_target_use_OpenGR_included TRUE) - -function(CGAL_target_use_OpenGR target) - target_include_directories(${target} PUBLIC ${OpenGR_INCLUDE_DIR}) - target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_OPENGR) -endfunction() diff --git a/Installation/cmake/modules/CGAL_target_use_SCIP.cmake b/Installation/cmake/modules/CGAL_target_use_SCIP.cmake deleted file mode 100644 index 354216bb1f7..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_SCIP.cmake +++ /dev/null @@ -1,11 +0,0 @@ -if (CGAL_target_use_SCIP_included) - return() -endif() -set(CGAL_target_use_SCIP_included TRUE) - -function(CGAL_target_use_SCIP target) - target_include_directories(${target} PUBLIC ${SCIP_INCLUDE_DIRS}) - target_compile_options(${target} PUBLIC -DCGAL_USE_SCIP) - target_link_libraries(${target} PUBLIC ${SCIP_LIBRARIES}) -endfunction() - diff --git a/Installation/cmake/modules/CGAL_target_use_TBB.cmake b/Installation/cmake/modules/CGAL_target_use_TBB.cmake index 76c41c4ec25..5f68060eea5 100644 --- a/Installation/cmake/modules/CGAL_target_use_TBB.cmake +++ b/Installation/cmake/modules/CGAL_target_use_TBB.cmake @@ -6,7 +6,9 @@ set(CGAL_target_use_TBB_included TRUE) set(TBB_USE_FILE "UseTBB") function(CGAL_target_use_TBB target) - if(NOT TARGET Threads::Threads) + message(DEPRECATION "This file CGAL_target_use_TBB.cmake is deprecated, and the imported target `CGAL::TBB_support` from CGAL_TBB_support.cmake should be used instead.") + if(NOT TARGET + Threads::Threads) find_package(Threads REQUIRED) endif() target_link_libraries( ${target} PUBLIC TBB::tbb TBB::tbbmalloc Threads::Threads) diff --git a/Installation/cmake/modules/CGAL_target_use_TensorFlow.cmake b/Installation/cmake/modules/CGAL_target_use_TensorFlow.cmake deleted file mode 100644 index 80bda689dab..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_TensorFlow.cmake +++ /dev/null @@ -1,10 +0,0 @@ -if (CGAL_target_use_TensorFlow_included) - return() -endif() -set(CGAL_target_use_TensorFlow_included TRUE) - -function(CGAL_target_use_TensorFlow target) - target_include_directories(${target} PUBLIC ${TensorFlow_INCLUDE_DIR}) - target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_TENSORFLOW) - target_link_libraries(${target} PUBLIC ${TensorFlow_LIBRARU}) -endfunction() diff --git a/Installation/cmake/modules/CGAL_target_use_pointmatcher.cmake b/Installation/cmake/modules/CGAL_target_use_pointmatcher.cmake deleted file mode 100644 index 5047815a336..00000000000 --- a/Installation/cmake/modules/CGAL_target_use_pointmatcher.cmake +++ /dev/null @@ -1,10 +0,0 @@ -if (CGAL_target_use_pointmatcher_included) - return() -endif() -set(CGAL_target_use_pointmatcher_included TRUE) - -function(CGAL_target_use_pointmatcher target) - target_include_directories(${target} PUBLIC ${libpointmatcher_INCLUDE_DIR}) - target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_POINTMATCHER) - target_link_libraries(${target} PUBLIC ${libpointmatcher_LIBRARIES}) -endfunction() diff --git a/Installation/cmake/modules/UseTBB.cmake b/Installation/cmake/modules/UseTBB.cmake index 5a22f6f079a..a1322a2f3a6 100644 --- a/Installation/cmake/modules/UseTBB.cmake +++ b/Installation/cmake/modules/UseTBB.cmake @@ -5,4 +5,4 @@ include_directories ( ${TBB_INCLUDE_DIRS} ) link_directories( ${TBB_LIBRARY_DIRS} ) add_definitions( -DNOMINMAX -DCGAL_LINKED_WITH_TBB ) -message(DEPRECATION "This file UseTBB.cmake is deprecated, and the function `CGAL_target_use_TBB` from CGAL_target_use_TBB.cmake should be used instead.") +message(DEPRECATION "This file UseTBB.cmake is deprecated, and the imported target `CGAL::TBB_support` from CGAL_TBB_support.cmake should be used instead.") diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index cba75d0bb15..7dd169ead9f 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -48,9 +48,10 @@ if ( CGAL_FOUND ) endif() find_package( TBB QUIET ) + include(CGAL_TBB_support) create_single_source_cgal_program( "test_TBB.cpp" ) - if(TBB_FOUND) - CGAL_target_use_TBB(test_TBB) + if(TARGET CGAl::TBB_support) + target_link_libraries(test_TBB PUBLIC CGAL::TBB_support) endif() create_link_to_program(CGAL) diff --git a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt index b52c55f79a3..74595d7724f 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt @@ -13,7 +13,8 @@ if ( CGAL_FOUND ) # use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) # Link with Boost.ProgramOptions (optional) find_package(Boost QUIET COMPONENTS program_options) if(Boost_PROGRAM_OPTIONS_FOUND) @@ -30,9 +31,9 @@ if ( CGAL_FOUND ) endif() create_single_source_cgal_program( "Mesh_estimation.cpp" ) - CGAL_target_use_Eigen(Mesh_estimation) + target_link_libraries(Mesh_estimation PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "Single_estimation.cpp" ) - CGAL_target_use_Eigen(Single_estimation) + target_link_libraries(Single_estimation PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") @@ -43,4 +44,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt index feff5e7bb7a..2ff8f62b541 100644 --- a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt @@ -13,9 +13,10 @@ if ( CGAL_FOUND ) # use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "blind_1pt.cpp" ) - CGAL_target_use_Eigen(blind_1pt) + target_link_libraries(blind_1pt PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") endif() @@ -25,4 +26,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt index aa4ede4ecf7..1987d458724 100644 --- a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt +++ b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt @@ -57,12 +57,14 @@ if ( CGAL_FOUND ) if( CGAL_ACTIVATE_CONCURRENT_MESH_3 ) add_definitions( -DCGAL_CONCURRENT_MESH_3 ) find_package( TBB REQUIRED ) + include(CGAL_TBB_support) else() option( LINK_WITH_TBB "Link with TBB anyway so we can use TBB timers for profiling" ON) if( LINK_WITH_TBB ) find_package( TBB ) + include(CGAL_TBB_support) endif( LINK_WITH_TBB ) endif() @@ -81,11 +83,11 @@ if ( CGAL_FOUND ) if ( Boost_FOUND AND Boost_VERSION GREATER 103400 ) # Compilable benchmark set (BENCHMARK_SOURCE_FILES "concurrency.cpp") - if(TBB_FOUND) - CGAL_target_use_TBB(concurrency) - endif() ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" BENCHMARK_SOURCE_FILES) create_single_source_cgal_program( ${BENCHMARK_SOURCE_FILES} ) + if(TARGET CGAL::TBB_support) + target_link_libraries(concurrency PUBLIC CGAL::TBB_support) + endif() else() message(STATUS "NOTICE: This program requires Boost >= 1.34.1, and will not be compiled.") @@ -94,4 +96,3 @@ if ( CGAL_FOUND ) else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 7a259ab4037..851ce574dec 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -34,18 +34,21 @@ if ( CGAL_FOUND ) if( CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3} ) add_definitions( -DCGAL_CONCURRENT_MESH_3 ) find_package( TBB REQUIRED ) + include(CGAL_TBB_support) else( CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3} ) option( LINK_WITH_TBB "Link with TBB anyway so we can use TBB timers for profiling" ON) if( LINK_WITH_TBB ) find_package( TBB ) + include(CGAL_TBB_support) endif( LINK_WITH_TBB ) endif() # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) - if (NOT EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() @@ -70,92 +73,91 @@ if ( CGAL_FOUND ) # Compilable examples create_single_source_cgal_program( "mesh_hybrid_mesh_domain.cpp" ) - CGAL_target_use_Eigen(mesh_hybrid_mesh_domain) + target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_implicit_sphere.cpp" ) - CGAL_target_use_Eigen(mesh_implicit_sphere) + target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" ) - CGAL_target_use_Eigen(mesh_implicit_sphere_variable_size) + target_link_libraries(mesh_implicit_sphere_variable_size PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" ) - CGAL_target_use_Eigen(mesh_two_implicit_spheres_with_balls) + target_link_libraries(mesh_two_implicit_spheres_with_balls PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" ) - CGAL_target_use_Eigen(mesh_implicit_domains_2) + target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_cubes_intersection.cpp" ) - CGAL_target_use_Eigen(mesh_cubes_intersection) + target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" ) - CGAL_target_use_Eigen(mesh_cubes_intersection_with_features) + target_link_libraries(mesh_cubes_intersection_with_features PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" ) - CGAL_target_use_Eigen(mesh_implicit_domains) + target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_domain) + target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_domain_sm.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_domain_sm) + target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_domain_with_surface_inside.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_domain_with_surface_inside) + target_link_libraries(mesh_polyhedral_domain_with_surface_inside PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" ) - CGAL_target_use_Eigen(remesh_polyhedral_surface) + target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "remesh_polyhedral_surface_sm.cpp" ) - CGAL_target_use_Eigen(remesh_polyhedral_surface_sm) + target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_domain_with_features) + target_link_libraries(mesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_domain_with_features_sm.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_domain_with_features_sm) + target_link_libraries(mesh_polyhedral_domain_with_features_sm PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_domain_with_lipschitz_sizing.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_domain_with_lipschitz_sizing) + target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_complex) + target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" ) - CGAL_target_use_Eigen(mesh_polyhedral_complex_sm) + target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen_support) if( WITH_CGAL_ImageIO ) if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) ) add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) - CGAL_target_use_Eigen(mesh_3D_gray_vtk_image) - target_link_libraries( mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) + target_link_libraries( mesh_3D_gray_vtk_image PUBLIC CGAL::Eigen_support ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) cgal_add_test( mesh_3D_gray_vtk_image ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image ) endif() create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) - CGAL_target_use_Eigen(mesh_3D_gray_image) + target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_3D_gray_image_multiple_values.cpp" ) - CGAL_target_use_Eigen(mesh_3D_gray_image_multiple_values) + target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" ) - CGAL_target_use_Eigen(mesh_3D_image_with_features) + target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen_support) if( CGAL_ImageIO_USE_ZLIB ) create_single_source_cgal_program( "mesh_optimization_example.cpp" ) - CGAL_target_use_Eigen(mesh_optimization_example) + target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" ) - CGAL_target_use_Eigen(mesh_optimization_lloyd_example) + target_link_libraries(mesh_optimization_lloyd_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_3D_image.cpp" ) - CGAL_target_use_Eigen(mesh_3D_image) + target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" ) - CGAL_target_use_Eigen(mesh_3D_image_with_custom_initialization) + target_link_libraries(mesh_3D_image_with_custom_initialization PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" ) - CGAL_target_use_Eigen(mesh_3D_image_variable_size) + target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen_support) else() message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." ) endif() @@ -167,28 +169,27 @@ if ( CGAL_FOUND ) # create_single_source_cgal_program( "mesh_polyhedral_surface_tolerance_region.cpp" ) # create_single_source_cgal_program( "mesh_polyhedral_edge_tolerance_region.cpp" ) - if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TBB_FOUND AND TARGET ${target}) + if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support AND TARGET ${target}) foreach(target - mesh_3D_image_with_features - mesh_3D_image - mesh_polyhedral_domain - mesh_3D_image_with_custom_initialization - mesh_two_implicit_spheres_with_balls - mesh_optimization_lloyd_example - mesh_optimization_example - mesh_implicit_sphere - mesh_polyhedral_complex_sm - mesh_implicit_sphere_variable_size - mesh_polyhedral_domain_sm - mesh_polyhedral_domain_with_lipschitz_sizing - mesh_polyhedral_complex - mesh_polyhedral_domain_with_features - mesh_3D_image_variable_size) - CGAL_target_use_TBB(${target}) + mesh_3D_image_with_features + mesh_3D_image + mesh_polyhedral_domain + mesh_3D_image_with_custom_initialization + mesh_two_implicit_spheres_with_balls + mesh_optimization_lloyd_example + mesh_optimization_example + mesh_implicit_sphere + mesh_polyhedral_complex_sm + mesh_implicit_sphere_variable_size + mesh_polyhedral_domain_sm + mesh_polyhedral_domain_with_lipschitz_sizing + mesh_polyhedral_complex + mesh_polyhedral_domain_with_features + mesh_3D_image_variable_size) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) endforeach() endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index ee17ea5e154..d731e12d4e4 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -16,10 +16,12 @@ if ( CGAL_FOUND ) include( ${CGAL_USE_FILE} ) find_package( TBB QUIET ) + include(CGAL_TBB_support) # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) - if (NOT EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() @@ -91,32 +93,33 @@ if ( CGAL_FOUND ) test_mesh_polyhedral_domain_with_features_deprecated test_meshing_with_one_step.cpp) if(TARGET ${target}) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endif() endforeach() - foreach(target - test_meshing_verbose - test_meshing_polyhedron_with_features - test_meshing_utilities.h - test_meshing_implicit_function - test_meshing_3D_image - test_meshing_3D_gray_image - test_meshing_unit_tetrahedron - test_meshing_polyhedron - test_meshing_polyhedral_complex - test_mesh_capsule_var_distance_bound - test_mesh_3_issue_1554 - test_mesh_polyhedral_domain_with_features_deprecated - ) - if(TBB_FOUND AND TARGET ${target}) - CGAL_target_use_TBB(${target}) - endif() - endforeach() + if(TARGET CGAL::TBB_support) + foreach(target + test_meshing_verbose + test_meshing_polyhedron_with_features + test_meshing_utilities.h + test_meshing_implicit_function + test_meshing_3D_image + test_meshing_3D_gray_image + test_meshing_unit_tetrahedron + test_meshing_polyhedron + test_meshing_polyhedral_complex + test_mesh_capsule_var_distance_bound + test_mesh_3_issue_1554 + test_mesh_polyhedral_domain_with_features_deprecated + ) + if(TARGET ${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) + endif() + endforeach() + endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/NewKernel_d/test/NewKernel_d/CMakeLists.txt b/NewKernel_d/test/NewKernel_d/CMakeLists.txt index e315981083a..ba586fee06d 100644 --- a/NewKernel_d/test/NewKernel_d/CMakeLists.txt +++ b/NewKernel_d/test/NewKernel_d/CMakeLists.txt @@ -17,9 +17,10 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "Epick_d.cpp" ) - CGAL_target_use_Eigen(Epick_d) + target_link_libraries(Epick_d PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: This program requires the Eigen3 library, and will not be compiled.") @@ -31,4 +32,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index a10e4a8ee8b..52dd912d2f4 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -82,8 +82,9 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "eigen.cpp" ) find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) - if (EIGEN3_FOUND) - cgal_target_use_Eigen(eigen) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) + target_link_libraries(eigen PUBLIC CGAL::Eigen_support) endif() else( CGAL_FOUND ) diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt index bcb9a3247c0..0b936e2c370 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt @@ -23,7 +23,8 @@ endif() # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() @@ -52,5 +53,5 @@ foreach(target mesh_implicit_shape_with_subdomains mesh_implicit_shape_with_optimizers mesh_implicit_shape_with_features) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() diff --git a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt index 3a3f69e79d7..ceba5546a54 100644 --- a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt @@ -16,21 +16,21 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) - if (NOT EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() create_single_source_cgal_program( "test_implicit_shapes_bunch.cpp" ) - CGAL_target_use_Eigen(test_implicit_shapes_bunch) + target_link_libraries(test_implicit_shapes_bunch PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "test_implicit_shapes_with_features.cpp" ) - CGAL_target_use_Eigen(test_implicit_shapes_with_features) + target_link_libraries(test_implicit_shapes_with_features PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "test_triply_periodic_minimal_surfaces.cpp" ) - CGAL_target_use_Eigen(test_triply_periodic_minimal_surfaces) + target_link_libraries(test_triply_periodic_minimal_surfaces PUBLIC CGAL::Eigen_support) else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Point_set_3/examples/Point_set_3/CMakeLists.txt b/Point_set_3/examples/Point_set_3/CMakeLists.txt index 172e045e4d2..cc8a77fb8b6 100644 --- a/Point_set_3/examples/Point_set_3/CMakeLists.txt +++ b/Point_set_3/examples/Point_set_3/CMakeLists.txt @@ -44,9 +44,10 @@ set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) create_single_source_cgal_program( "point_set_read_ply.cpp" CXX_FEATURES ${needed_cxx_features} ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) +include(CGAL_Eigen_support) if (EIGEN3_FOUND) create_single_source_cgal_program( "point_set_algo.cpp" ) - CGAL_target_use_Eigen(point_set_algo) + target_link_libraries(point_set_algo PUBLIC CGAL::Eigen_support) endif() create_single_source_cgal_program("draw_point_set_3.cpp" ) diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index f057bb7332b..33f229e2fe9 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -27,6 +27,7 @@ if ( CGAL_FOUND ) ADD_DEFINITIONS( "-DDEBUG_TRACE" ) find_package( TBB QUIET ) + include(CGAL_TBB_support) # Executables that do *not* require Eigen create_single_source_cgal_program( "read_test.cpp" ) @@ -40,30 +41,31 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) + include(CGAL_Eigen_support) if (EIGEN3_FOUND) # Executables that require Eigen create_single_source_cgal_program( "normal_estimation_test.cpp" ) - CGAL_target_use_Eigen(normal_estimation_test) + target_link_libraries(normal_estimation_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "hierarchy_simplification_test.cpp" ) - CGAL_target_use_Eigen(hierarchy_simplification_test) + target_link_libraries(hierarchy_simplification_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "smoothing_test.cpp" ) - CGAL_target_use_Eigen(smoothing_test) + target_link_libraries(smoothing_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vcm_plane_test.cpp" ) - CGAL_target_use_Eigen(vcm_plane_test) + target_link_libraries(vcm_plane_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vcm_all_test.cpp" ) - CGAL_target_use_Eigen(vcm_all_test) + target_link_libraries(vcm_all_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "jet_pointer_as_property_map.cpp" ) - CGAL_target_use_Eigen(jet_pointer_as_property_map) + target_link_libraries(jet_pointer_as_property_map PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") endif() - if (TBB_FOUND) + if (TARGET CGAL::TBB_support) foreach(target analysis_test smoothing_test @@ -72,7 +74,7 @@ if ( CGAL_FOUND ) edge_aware_upsample_test normal_estimation_test) if(TARGET ${target}) - CGAL_target_use_TBB(${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) endif() endforeach() endif() @@ -82,4 +84,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt index a7eb729ec77..b67981f06b6 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -23,16 +23,17 @@ if ( CGAL_FOUND ) # Find Eigen3 (requires 3.1.0 or greater) find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) # Executables that require Eigen 3 create_single_source_cgal_program( "poisson_reconstruction_example.cpp" ) - CGAL_target_use_Eigen(poisson_reconstruction_example) + target_link_libraries(poisson_reconstruction_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "poisson_reconstruction.cpp" ) - CGAL_target_use_Eigen(poisson_reconstruction) + target_link_libraries(poisson_reconstruction PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "poisson_reconstruction_function.cpp" ) - CGAL_target_use_Eigen(poisson_reconstruction_function) + target_link_libraries(poisson_reconstruction_function PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "tutorial_example.cpp" ) - CGAL_target_use_Eigen(tutorial_example) + target_link_libraries(tutorial_example PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: The examples need Eigen 3.1 (or greater) will not be compiled.") endif() @@ -43,4 +44,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt index 1c518a1267b..b8cb454be73 100644 --- a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -24,10 +24,11 @@ if ( CGAL_FOUND ) # Temporary debugging stuff find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if(EIGEN3_FOUND) + include(CGAL_Eigen_support) + if(TARGET CGAL::Eigen_support) # Executables that require Eigen 3.1 create_single_source_cgal_program( "poisson_reconstruction_test.cpp" ) - CGAL_target_use_Eigen(poisson_reconstruction_test) + target_link_libraries(poisson_reconstruction_test PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.") @@ -39,4 +40,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt index 33c8b074104..008b892cd43 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt @@ -29,6 +29,7 @@ endif() # include for local package find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) # Creating entries for all .cpp/.C files with "main" routine # ########################################################## @@ -37,8 +38,7 @@ create_single_source_cgal_program( "polygon_mesh_slicer.cpp" ) create_single_source_cgal_program( "hole_filling.cpp" ) -if (EIGEN3_FOUND) - CGAL_target_use_Eigen(polygon_mesh_slicer) - CGAL_target_use_Eigen(hole_filling) +if (TARGET CGAL::Eigen_support) + target_link_libraries(polygon_mesh_slicer PUBLIC CGAL::Eigen_support) + target_link_libraries(hole_filling PUBLIC CGAL::Eigen_support) endif() - diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 151f4fe333c..46a7f04d886 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -38,6 +38,7 @@ endif() # include for local package find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) # Creating entries for all .cpp/.C files with "main" routine @@ -45,18 +46,18 @@ find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) create_single_source_cgal_program( "hausdorff_distance_remeshing_example.cpp") -if (EIGEN3_FOUND) +if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "hole_filling_example.cpp" ) - CGAL_target_use_Eigen(hole_filling_example) + target_link_libraries(hole_filling_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "hole_filling_example_SM.cpp" ) - CGAL_target_use_Eigen(hole_filling_example_SM) + target_link_libraries(hole_filling_example_SM PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "refine_fair_example.cpp") - CGAL_target_use_Eigen(refine_fair_example) + target_link_libraries(refine_fair_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "shape_smoothing_example.cpp") - CGAL_target_use_Eigen(shape_smoothing_example) + target_link_libraries(shape_smoothing_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "hole_filling_example_LCC.cpp" ) - CGAL_target_use_Eigen(hole_filling_example_LCC) -endif(EIGEN3_FOUND) + target_link_libraries(hole_filling_example_LCC PUBLIC CGAL::Eigen_support) +endif() create_single_source_cgal_program( "self_intersections_example.cpp" ) create_single_source_cgal_program( "stitch_borders_example.cpp" ) @@ -98,10 +99,9 @@ if(OpenMesh_FOUND) create_single_source_cgal_program( "compute_normals_example_OM.cpp" ) target_link_libraries( compute_normals_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) -if (EIGEN3_FOUND) +if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "hole_filling_example_OM.cpp" ) - target_link_libraries( hole_filling_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) - CGAL_target_use_Eigen( hole_filling_example_OM ) + target_link_libraries( hole_filling_example_OM PRIVATE CGAL::Eigen_support ${OPENMESH_LIBRARIES} ) endif() create_single_source_cgal_program( "point_inside_example_OM.cpp") @@ -118,9 +118,10 @@ target_link_libraries( triangulate_faces_example_OM PRIVATE ${OPENMESH_LIBRARIES endif(OpenMesh_FOUND) find_package( TBB ) -if( TBB_FOUND ) - CGAL_target_use_TBB(self_intersections_example) - CGAL_target_use_TBB(hausdorff_distance_remeshing_example) +include(CGAL_TBB_support) +if( TARGET CGAL::TBB_support ) + target_link_libraries(self_intersections_example PUBLIC CGAL::TBB_support) + target_link_libraries(hausdorff_distance_remeshing_example PUBLIC CGAL::TBB_support) else() message( STATUS "NOTICE: Intel TBB was not found. Sequential code will be used." ) endif() diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index f18ccb8bd61..214d55114f2 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -31,22 +31,24 @@ endif() # include for local package find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) find_package( TBB ) +include(CGAL_TBB_support) -if (EIGEN3_FOUND) +if (TARGET CGAL::Eigen_support) # Creating entries for all .cpp/.C files with "main" routine # ########################################################## create_single_source_cgal_program("fairing_test.cpp") - CGAL_target_use_Eigen(fairing_test) + target_link_libraries(fairing_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program("triangulate_hole_Polyhedron_3_no_delaunay_test.cpp" ) - CGAL_target_use_Eigen(triangulate_hole_Polyhedron_3_no_delaunay_test) + target_link_libraries(triangulate_hole_Polyhedron_3_no_delaunay_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program("triangulate_hole_Polyhedron_3_test.cpp") - CGAL_target_use_Eigen(triangulate_hole_Polyhedron_3_test) + target_link_libraries(triangulate_hole_Polyhedron_3_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program("test_shape_smoothing.cpp") - CGAL_target_use_Eigen(test_shape_smoothing) + target_link_libraries(test_shape_smoothing PUBLIC CGAL::Eigen_support) -endif(EIGEN3_FOUND) +endif() find_package( OpenMesh QUIET ) if ( OpenMesh_FOUND ) @@ -103,11 +105,10 @@ endif() create_single_source_cgal_program("test_remove_caps_needles.cpp") # create_single_source_cgal_program("test_pmp_repair_self_intersections.cpp") - if( TBB_FOUND ) - include(CGAL_target_use_TBB) - CGAL_target_use_TBB(test_pmp_distance) - CGAL_target_use_TBB(orient_polygon_soup_test) - CGAL_target_use_TBB(self_intersection_surface_mesh_test) + if( TARGET CGAL::TBB_support ) + target_link_libraries(test_pmp_distance PUBLIC CGAL::TBB_support) + target_link_libraries(orient_polygon_soup_test PUBLIC CGAL::TBB_support) + target_link_libraries(self_intersection_surface_mesh_test PUBLIC CGAL::TBB_support) else() message( STATUS "NOTICE: Intel TBB was not found. test_pmp_distance will use sequential code." ) endif() diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index 5fd39e6bcc1..68eec9daba7 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -37,15 +37,18 @@ endif() include( CGAL_CreateSingleSourceCGALProgram ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) -if(NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if(NOT TARGET CGAL::Eigen_support) message(STATUS "NOTICE: This project requires Eigen 3.1 (or greater) and will not be compiled.") return() endif() find_package(SCIP QUIET) -if (NOT SCIP_FOUND ) +include(CGAL_SCIP_support) +if (NOT TARGET CGAL::SCIP_support ) find_package( GLPK QUIET) - if ( NOT GLPK_FOUND ) + include(CGAL_GLPK_support) + if (NOT TARGET CGAL::GLPK_support ) message( STATUS "NOTICE: This project requires either SCIP or GLPK, and will not be compiled.") return() endif() @@ -61,10 +64,10 @@ foreach(target polyfit_example_user_provided_planes polyfit_example_model_complexty_control polyfit_example_with_region_growing) - CGAL_target_use_Eigen(${target}) - if (SCIP_FOUND) - CGAL_target_use_SCIP(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) + if (TARGET CGAL::SCIP_support) + target_link_libraries(${target} PUBLIC CGAL::SCIP_support) else() - CGAL_target_use_GLPK(${target}) + target_link_libraries(${target} PUBLIC CGAL::GLPK_support) endif() endforeach() diff --git a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt index fb12c54a420..7ce3ba34320 100644 --- a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt @@ -38,24 +38,27 @@ include( CGAL_CreateSingleSourceCGALProgram ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) -if(NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if(NOT TARGET CGAL::Eigen_support) message(STATUS "NOTICE: This project requires Eigen 3.1 (or greater) and will not be compiled.") return() endif() find_package(SCIP QUIET) -if (NOT SCIP_FOUND ) +include(CGAL_SCIP_support) +if (NOT TARGET CGAL::SCIP_support ) find_package( GLPK QUIET) - if ( NOT GLPK_FOUND ) - message( STATUS "NOTICE : This project requires either SCIP or GLPK, and will not be compiled.") + include(CGAL_GLPK_support) + if (NOT TARGET CGAL::GLPK_support ) + message( STATUS "NOTICE: This project requires either SCIP or GLPK, and will not be compiled.") return() endif() endif() create_single_source_cgal_program( "polygonal_surface_reconstruction_test.cpp") -CGAL_target_use_Eigen(polygonal_surface_reconstruction_test) -if (SCIP_FOUND) - CGAL_target_use_SCIP(polygonal_surface_reconstruction_test) +target_link_libraries(polygonal_surface_reconstruction_test PUBLIC CGAL::Eigen_support) +if (TARGET CGAL::SCIP_support) + target_link_libraries(polygonal_surface_reconstruction_test PUBLIC CGAL::SCIP_support) else() - CGAL_target_use_GLPK(polygonal_surface_reconstruction_test) + target_link_libraries(polygonal_surface_reconstruction_test PUBLIC CGAL::GLPK_support) endif() diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 9e00808a516..d6914d1aa07 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -73,6 +73,7 @@ if(Qt5_FOUND) endif(Qt5_FOUND) find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) find_package( METIS ) @@ -87,7 +88,8 @@ option(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY if( POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY ) find_package( TBB ) - if( NOT TBB_FOUND ) + include(CGAL_TBB_support) + if( NOT TARGET CGAL::TBB_support ) message( STATUS "NOTICE: Intel TBB was not found. Bilateral smoothing and WLOP plugins are faster if TBB is linked." ) endif() endif() @@ -108,7 +110,8 @@ if( CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3} ) add_definitions( -DCGAL_CONCURRENT_MESH_3 ) if(NOT TBB_FOUND) find_package( TBB REQUIRED ) - if( NOT TBB_FOUND ) + include( CGAL_TBB_support) + if( NOT TARGET CGAL::TBB_support ) message(STATUS "NOTICE: Intel TBB was not found. Mesh_3 is faster if TBB is linked.") endif() endif() @@ -119,6 +122,7 @@ else( CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3} ) ON) if( LINK_WITH_TBB ) find_package( TBB ) + include( CGAL_TBB_support) endif( LINK_WITH_TBB ) endif() @@ -248,8 +252,8 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_c3t3_item Scene_c3t3_item.cpp) target_link_libraries(scene_c3t3_item PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_basic_objects ${TBB_LIBRARIES}) - if(TBB_FOUND) - CGAL_target_use_TBB(scene_c3t3_item) + if(TARGET CGAL::TBB_support) + target_link_libraries(scene_c3t3_item PUBLIC CGAL::TBB_support) endif() if(COMMAND target_precompile_headers) # Support for precompiled headers, for Mesh_3 (since CMake 3.16) @@ -261,7 +265,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_surface_mesh_item Scene_surface_mesh_item.cpp) if(TBB_FOUND) - CGAL_target_use_TBB(scene_surface_mesh_item) + target_link_libraries(scene_surface_mesh_item PUBLIC CGAL::TBB_support) endif() # special @@ -274,7 +278,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_selection_item Scene_polyhedron_selection_item.cpp) target_link_libraries(scene_selection_item PUBLIC scene_item_decorator scene_k_ring_selection) if(TBB_FOUND) - CGAL_target_use_TBB(scene_selection_item) + target_link_libraries(scene_selection_item PUBLIC CGAL::TBB_support) endif() add_item(scene_shortest_path_item Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp) @@ -282,17 +286,16 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_movable_sm_item Plugins/AABB_tree/Scene_movable_sm_item.cpp) - if(EIGEN3_FOUND ) + if(TARGET CGAL::Eigen_support ) add_item(scene_textured_item Scene_textured_surface_mesh_item.cpp texture.cpp) - CGAL_target_use_Eigen(scene_textured_item) + target_link_libraries(scene_textured_item PUBLIC CGAL::Eigen_support) qt5_wrap_ui( editionUI_FILES Plugins/Surface_mesh_deformation/Deform_mesh.ui ) add_item(scene_edit_item Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp ${editionUI_FILES}) - CGAL_target_use_Eigen(scene_edit_item) - target_link_libraries(scene_edit_item PUBLIC scene_surface_mesh_item scene_k_ring_selection + target_link_libraries(scene_edit_item PUBLIC CGAL::Eigen_support scene_surface_mesh_item scene_k_ring_selection scene_basic_objects) add_item(scene_mcf_item Plugins/PMP/Scene_mcf_item.cpp) - CGAL_target_use_Eigen(scene_mcf_item) + target_link_libraries(scene_mcf_item PUBLIC CGAL::Eigen_support) endif() add_item(scene_implicit_function_item Scene_implicit_function_item.cpp ) @@ -305,20 +308,21 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) target_link_libraries(scene_nef_polyhedron_item PUBLIC scene_surface_mesh_item) add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp) - if (EIGEN3_FOUND) - CGAL_target_use_Eigen(scene_points_with_normal_item) + if (TARGET CGAL::Eigen_support) + target_link_libraries(scene_points_with_normal_item PUBLIC CGAL::Eigen_support) endif() find_package(LASLIB) - if (LASLIB_FOUND) - CGAL_target_use_LASLIB(scene_points_with_normal_item) + include(CGAL_LASLIB_support) + if (TARGET CGAL::LASLIB_support) + target_link_libraries(scene_points_with_normal_item PUBLIC CGAL::LASLIB_support) if (MSVC) target_compile_definitions( scene_points_with_normal_item PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") endif() endif() if(TBB_FOUND) - CGAL_target_use_TBB(scene_points_with_normal_item) + target_link_libraries(scene_points_with_normal_item PUBLIC CGAL::TBB_support) endif() add_item(scene_polylines_item Scene_polylines_item.cpp) diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt index bff0df4c9a1..1336c086cd7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt @@ -5,6 +5,6 @@ target_link_libraries(do_trees_intersect_plugin PUBLIC scene_surface_mesh_item s polyhedron_demo_plugin(cut_plugin Cut_plugin ) target_link_libraries(cut_plugin PUBLIC scene_surface_mesh_item scene_basic_objects scene_color_ramp) -if(TBB_FOUND) - CGAL_target_use_TBB(cut_plugin) +if(TARGET CGAL::TBB_support) + target_link_libraries(cut_plugin PUBLIC CGAL::TBB_support) endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt index b4a49753ce2..288c22109ff 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt @@ -1,54 +1,61 @@ include( polyhedron_demo_macros ) -if(EIGEN3_FOUND) +if(TARGET CGAL::Eigen_support) set(Classification_dependencies_met TRUE) find_package( Boost OPTIONAL_COMPONENTS serialization iostreams ) - if (NOT Boost_SERIALIZATION_FOUND) + include(CGAL_Boost_serialization_support) + include(CGAL_Boost_iostreams_support) + if (NOT TARGET CGAL::Boost_serialization_support) message(STATUS "NOTICE: Boost Serialization not found. Classification plugin won't be available.") set(Classification_dependencies_met FALSE) endif() - if (NOT Boost_IOSTREAMS_FOUND) + if (NOT TARGET CGAL::Boost_iostreams_support) message(STATUS "NOTICE: Boost IOStreams not found. Classification plugin won't be available.") set(Classification_dependencies_met FALSE) endif() find_package(OpenCV QUIET COMPONENTS core ml) # Need core + machine learning - if (NOT OpenCV_FOUND) + include(CGAL_OpenCV_support) + if (NOT TARGET CGAL::OpenCV_support) message(STATUS "NOTICE: OpenCV was not found. OpenCV random forest predicate for classification won't be available.") endif() find_package(TensorFlow QUIET) - if (NOT TensorFlow_FOUND) + include(CGAL_TensorFlow_support) + if (NOT TARGET CGAL::TensorFlow_support) message(STATUS "NOTICE: TensorFlow not found, Neural Network predicate for classification won't be available.") endif() if (Classification_dependencies_met) qt5_wrap_ui( classificationUI_FILES Classification_widget.ui Classification_advanced_widget.ui ) polyhedron_demo_plugin(classification_plugin Classification_plugin Point_set_item_classification Cluster_classification Surface_mesh_item_classification ${classificationUI_FILES} KEYWORDS Classification) - target_link_libraries(classification_plugin PUBLIC scene_points_with_normal_item - scene_polylines_item scene_polygon_soup_item scene_surface_mesh_item scene_selection_item scene_color_ramp) + target_link_libraries(classification_plugin PUBLIC + scene_points_with_normal_item + scene_polylines_item + scene_polygon_soup_item + scene_surface_mesh_item + scene_selection_item + scene_color_ramp + CGAL::Eigen_support + CGAL::Boost_serialization_support + CGAL::Boost_iostreams_support) - CGAL_target_use_Eigen(classification_plugin) - CGAL_target_use_Boost_IOStreams(classification_plugin) - CGAL_target_use_Boost_Serialization(classification_plugin) if(OpenCV_FOUND) - CGAL_target_use_OpenCV(classification_plugin) + target_link_libraries(classification_plugin PUBLIC CGAL::OpenCV_support) endif() if(TensorFlow_FOUND) - CGAL_target_use_TensorFlow(classification_plugin) + target_link_libraries(classification_plugin PUBLIC CGAL::TensorFlow_support) endif() if(TBB_FOUND) - CGAL_target_use_TBB(classification_plugin) + target_link_libraries(classification_plugin PUBLIC CGAL::TBB_support) endif() add_dependencies(classification_plugin point_set_selection_plugin selection_plugin) endif() -else(EIGEN3_FOUND) +else() message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Classification plugin will not be available.") endif() - - diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt index c783cd751ac..0f03d24021e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt @@ -1,7 +1,6 @@ include( polyhedron_demo_macros ) -if(EIGEN3_FOUND) +if(TARGET CGAL::Eigen_support) qt5_wrap_ui( display_propertyUI_FILES Display_property.ui ) polyhedron_demo_plugin(display_property_plugin Display_property_plugin ${display_propertyUI_FILES}) - target_link_libraries(display_property_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_color_ramp) - CGAL_target_use_Eigen(display_property_plugin) -endif(EIGEN3_FOUND) + target_link_libraries(display_property_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_color_ramp CGAL::Eigen_support) +endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt index c5c5f52ccd8..753eb232b22 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt @@ -69,11 +69,10 @@ else() target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_textured_item) target_compile_features(ply_plugin PRIVATE ${needed_cxx_features}) - if (LASLIB_FOUND) + if (TARGET CGAL::LASLIB_support) polyhedron_demo_plugin(las_plugin LAS_io_plugin KEYWORDS IO PointSetProcessing Classification) - target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item) + target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item CGAL::LASLIB_support) target_compile_features(las_plugin PRIVATE ${needed_cxx_features}) - CGAL_target_use_LASLIB(las_plugin) else() message(STATUS "NOTICE : the LAS IO plugin needs LAS libraries and will not be compiled.") endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 8f1468406ac..a4e6ac600e2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -54,9 +54,10 @@ target_link_libraries(mesh_3_optimization_plugin PUBLIC scene_c3t3_item scene_su # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) + include(CGAL_Eigen_support) - if (EIGEN3_FOUND) - CGAL_target_use_Eigen(mesh_3_optimization_plugin) + if (TARGET CGAL::Eigen_support) + target_link_libraries(mesh_3_optimization_plugin PUBLIC CGAL::Eigen_support) else() #eigen message(STATUS "The Mesh_3_optimization_plugin requires Eigen, which was not found, and will use a deprecated class to replace it. Warnings are to be expected.") endif()#eigen @@ -69,8 +70,8 @@ polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI target_link_libraries(c3t3_rib_exporter_plugin PUBLIC scene_c3t3_item) if(TBB_FOUND) - CGAL_target_use_TBB(mesh_3_plugin) - CGAL_target_use_TBB(mesh_3_optimization_plugin) - CGAL_target_use_TBB(c3t3_io_plugin) - CGAL_target_use_TBB(c3t3_rib_exporter_plugin) + target_link_libraries(mesh_3_plugin PUBLIC CGAL::TBB_support) + target_link_libraries(mesh_3_optimization_plugin PUBLIC CGAL::TBB_support) + target_link_libraries(c3t3_io_plugin PUBLIC CGAL::TBB_support) + target_link_libraries(c3t3_rib_exporter_plugin PUBLIC CGAL::TBB_support) endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index f5380d67133..56d43cccef3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -1,33 +1,29 @@ include( polyhedron_demo_macros ) -if(EIGEN3_FOUND) +if(TARGET CGAL::Eigen_support) polyhedron_demo_plugin(jet_fitting_plugin Jet_fitting_plugin) - target_link_libraries(jet_fitting_plugin PUBLIC scene_surface_mesh_item scene_polylines_item) - CGAL_target_use_Eigen(jet_fitting_plugin) + target_link_libraries(jet_fitting_plugin PUBLIC scene_surface_mesh_item scene_polylines_item CGAL::Eigen_support) -else(EIGEN3_FOUND) +else() message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Jet fitting plugin will not be available.") -endif(EIGEN3_FOUND) +endif() polyhedron_demo_plugin(extrude_plugin Extrude_plugin KEYWORDS PMP) target_link_libraries(extrude_plugin PUBLIC scene_surface_mesh_item scene_selection_item) -if(EIGEN3_FOUND) +if(TARGET CGAL::Eigen_support) if("${EIGEN3_VERSION}" VERSION_GREATER "3.1.90") qt5_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui) polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES} KEYWORDS PMP) - target_link_libraries(hole_filling_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_selection_item) - CGAL_target_use_Eigen(hole_filling_plugin) + target_link_libraries(hole_filling_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_selection_item CGAL::Eigen_support) qt5_wrap_ui( fairingUI_FILES Fairing_widget.ui) polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES} KEYWORDS PMP) - target_link_libraries(fairing_plugin PUBLIC scene_selection_item) - CGAL_target_use_Eigen(fairing_plugin) + target_link_libraries(fairing_plugin PUBLIC scene_selection_item CGAL::Eigen_support) polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin ) - target_link_libraries(hole_filling_polyline_plugin PUBLIC scene_surface_mesh_item scene_polylines_item) - CGAL_target_use_Eigen(hole_filling_polyline_plugin) + target_link_libraries(hole_filling_polyline_plugin PUBLIC scene_surface_mesh_item scene_polylines_item CGAL::Eigen_support) qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES Mean_curvature_flow_skeleton_plugin.ui) polyhedron_demo_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES}) @@ -37,20 +33,19 @@ if(EIGEN3_FOUND) scene_points_with_normal_item scene_polylines_item scene_mcf_item - demo_framework) - CGAL_target_use_Eigen(mean_curvature_flow_skeleton_plugin) + demo_framework + CGAL::Eigen_support) # The smoothing plugin can still do some things, even if Ceres is not found qt5_wrap_ui( smoothingUI_FILES Smoothing_plugin.ui) polyhedron_demo_plugin(smoothing_plugin Smoothing_plugin ${smoothingUI_FILES}) - target_link_libraries(smoothing_plugin PUBLIC scene_surface_mesh_item scene_selection_item) - CGAL_target_use_Eigen(smoothing_plugin) + target_link_libraries(smoothing_plugin PUBLIC scene_surface_mesh_item scene_selection_item CGAL::Eigen_support) find_package(Ceres QUIET) if(TARGET ceres) target_compile_definitions( smoothing_plugin PRIVATE CGAL_PMP_USE_CERES_SOLVER ) target_link_libraries(smoothing_plugin PUBLIC ceres) endif() - CGAL_target_use_Eigen(extrude_plugin) + target_link_libraries(extrude_plugin PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.") endif() @@ -106,17 +101,16 @@ qt5_wrap_ui( isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui) polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES} KEYWORDS PMP) target_link_libraries(isotropic_remeshing_plugin PUBLIC scene_surface_mesh_item scene_selection_item) -if(TBB_FOUND) - CGAL_target_use_TBB(isotropic_remeshing_plugin) +if(TARGET CGAL::TBB_support) + target_link_libraries(isotropic_remeshing_plugin PUBLIC CGAL::TBB_support) endif() polyhedron_demo_plugin(distance_plugin Distance_plugin KEYWORDS PMP) target_link_libraries(distance_plugin PUBLIC scene_surface_mesh_item scene_color_ramp) -if(TBB_FOUND) - CGAL_target_use_TBB(distance_plugin) +if(TARGET CGAL::TBB_support) + target_link_libraries(distance_plugin PUBLIC CGAL::TBB_support) endif() - polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin KEYWORDS IO Mesh_3 PMP) target_link_libraries(detect_sharp_edges_plugin PUBLIC scene_surface_mesh_item) @@ -130,4 +124,3 @@ target_link_libraries(degenerated_faces_plugin PUBLIC scene_surface_mesh_item sc qt5_wrap_ui( engravUI_FILES Engrave_dock_widget.ui ) polyhedron_demo_plugin(engrave_text_plugin Engrave_text_plugin ${engravUI_FILES}) target_link_libraries(engrave_text_plugin PUBLIC scene_surface_mesh_item scene_selection_item scene_polylines_item) - diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt index eaf6ddfaf9f..63dd314cd54 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt @@ -1,60 +1,59 @@ include( polyhedron_demo_macros ) -if(EIGEN3_FOUND) +if(TARGET CGAL::Eigen_support) find_package(SCIP QUIET) - if(NOT SCIP_FOUND) + include(CGAL_SCIP_support) + if(NOT TARGET CGAL::SCIP_support) find_package(GLPK QUIET) + include(CGAL_GLPK_support) endif() - if(NOT SCIP_FOUND AND NOT GLPK_FOUND) + if(NOT TARGET CGAL::SCIP_support AND NOT TARGET CGAL::GLPK_support) message(STATUS "NOTICE: SCIP and GLPK were not found. Polygonal surface reconstruction will not be available.") endif() qt5_wrap_ui( surface_reconstructionUI_FILES Surface_reconstruction_plugin.ui) polyhedron_demo_plugin(surface_reconstruction_plugin Surface_reconstruction_plugin Surface_reconstruction_poisson_impl Surface_reconstruction_advancing_front_impl Surface_reconstruction_scale_space_impl Surface_reconstruction_polygonal_impl ${surface_reconstructionUI_FILES} KEYWORDS PointSetProcessing) - target_link_libraries(surface_reconstruction_plugin PUBLIC scene_polygon_soup_item scene_surface_mesh_item scene_points_with_normal_item) - CGAL_target_use_Eigen(surface_reconstruction_plugin) + target_link_libraries(surface_reconstruction_plugin PUBLIC scene_polygon_soup_item scene_surface_mesh_item scene_points_with_normal_item CGAL::Eigen_support) - if (SCIP_FOUND) - CGAL_target_use_SCIP(surface_reconstruction_plugin) - elseif(GLPK_FOUND) - CGAL_target_use_GLPK(surface_reconstruction_plugin) + if (TARGET CGAL::SCIP_support) + target_link_libraries(surface_reconstruction_plugin PUBLIC CGAL::SCIP_support) + elseif(TARGET CGAL::GLPK_support) + target_link_libraries(surface_reconstruction_plugin PUBLIC CGAL::GLPK_support) endif() qt5_wrap_ui( point_set_normal_estimationUI_FILES Point_set_normal_estimation_plugin.ui) polyhedron_demo_plugin(point_set_normal_estimation_plugin Point_set_normal_estimation_plugin ${point_set_normal_estimationUI_FILES} KEYWORDS PointSetProcessing Classification) - target_link_libraries(point_set_normal_estimation_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler) - CGAL_target_use_Eigen(point_set_normal_estimation_plugin) + target_link_libraries(point_set_normal_estimation_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler CGAL::Eigen_support) qt5_wrap_ui( features_detection_pluginUI_FILES Features_detection_plugin.ui) polyhedron_demo_plugin(features_detection_plugin Features_detection_plugin ${features_detection_pluginUI_FILES} KEYWORDS PointSetProcessing) - target_link_libraries(features_detection_plugin PUBLIC scene_points_with_normal_item) - CGAL_target_use_Eigen(features_detection_plugin) + target_link_libraries(features_detection_plugin PUBLIC scene_points_with_normal_item CGAL::Eigen_support) polyhedron_demo_plugin(point_set_smoothing_plugin Point_set_smoothing_plugin KEYWORDS PointSetProcessing) - target_link_libraries(point_set_smoothing_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler) - CGAL_target_use_Eigen(point_set_smoothing_plugin) + target_link_libraries(point_set_smoothing_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler CGAL::Eigen_support) polyhedron_demo_plugin(point_set_average_spacing_plugin Point_set_average_spacing_plugin KEYWORDS PointSetProcessing Classification) - target_link_libraries(point_set_average_spacing_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler) - CGAL_target_use_Eigen(point_set_average_spacing_plugin) + target_link_libraries(point_set_average_spacing_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler CGAL::Eigen_support) qt5_wrap_ui(point_set_shape_detectionUI_FILES Point_set_shape_detection_plugin.ui) polyhedron_demo_plugin(point_set_shape_detection_plugin Point_set_shape_detection_plugin ${point_set_shape_detectionUI_FILES} KEYWORDS PointSetProcessing Classification) - target_link_libraries(point_set_shape_detection_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_polygon_soup_item scene_callback_signaler) - CGAL_target_use_Eigen(point_set_shape_detection_plugin) + target_link_libraries(point_set_shape_detection_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_polygon_soup_item scene_callback_signaler CGAL::Eigen_support) find_package(OpenGR QUIET) + include(CGAL_OpenGR_support) find_package(libpointmatcher QUIET) + include(CGAL_pointmatcher_support) - if (OpenGR_FOUND OR libpointmatcher_FOUND) + if (TARGET CGAL::OpenGR_support OR CGAL::pointmatcher_support) qt5_wrap_ui(register_point_setsUI_FILES Register_point_sets_plugin.ui) polyhedron_demo_plugin(register_point_sets_plugin Register_point_sets_plugin ${register_point_setsUI_FILES} KEYWORDS PointSetProcessing) - if (OpenGR_FOUND) - CGAL_target_use_OpenGR(register_point_sets_plugin) + target_link_libraries(register_point_sets_plugin PUBLIC CGAL::Eigen_support) + if (TARGET CGAL::OpenGR_support) + target_link_libraries(register_point_sets_plugin PUBLIC CGAL::OpenGR_support) endif() - if (libpointmatcher_FOUND) - CGAL_target_use_pointmatcher(register_point_sets_plugin) + if (TARGET CGAL::pointmatcher_support) + target_link_libraries(register_point_sets_plugin PUBLIC CGAL::pointmatcher_support) endif() else() message(STATUS "NOTICE: OpenGR and libpointmatcher were not found. Registrationp plugin will not be available.") @@ -106,7 +105,7 @@ endif() polyhedron_demo_plugin(point_set_to_mesh_distance_plugin Point_set_to_mesh_distance_plugin ${distanceUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries(point_set_to_mesh_distance_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item scene_color_ramp) - if(TBB_FOUND) + if(TARGET CGAL::TBB_support) foreach(plugin surface_reconstruction_plugin point_set_normal_estimation_plugin @@ -125,7 +124,7 @@ endif() alpha_shape_plugin point_set_to_mesh_distance_plugin) if(TARGET ${plugin}) - CGAL_target_use_TBB(${plugin}) + target_link_libraries(${plugin} PUBLIC CGAL::TBB_support) endif() endforeach() endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index d56331772af..45c1eccb50e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -4,18 +4,17 @@ if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() -if(EIGEN3_FOUND) +if(TARGET CGAL::Eigen_support) find_package(CGAL COMPONENTS Core) include(${CGAL_USE_FILE}) qt5_wrap_ui(parameterizationUI_FILES Parameterization_widget.ui OTE_dialog.ui) polyhedron_demo_plugin(parameterization_plugin Parameterization_plugin ${parameterizationUI_FILES}) - target_link_libraries(parameterization_plugin PUBLIC scene_surface_mesh_item scene_textured_item scene_selection_item) - CGAL_target_use_Eigen(parameterization_plugin) -else(EIGEN3_FOUND) + target_link_libraries(parameterization_plugin PUBLIC scene_surface_mesh_item scene_textured_item scene_selection_item CGAL::Eigen_support) +else() message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. The Parameterization plugin will not be available.") -endif(EIGEN3_FOUND) +endif() qt5_wrap_ui( segmentationUI_FILES Mesh_segmentation_widget.ui) polyhedron_demo_plugin(mesh_segmentation_plugin Mesh_segmentation_plugin ${segmentationUI_FILES}) @@ -32,11 +31,11 @@ target_link_libraries(mesh_simplification_plugin PUBLIC scene_surface_mesh_item qt5_wrap_ui( remeshingUI_FILES Remeshing_dialog.ui) polyhedron_demo_plugin(offset_meshing_plugin Offset_meshing_plugin ${remeshingUI_FILES}) target_link_libraries(offset_meshing_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item) -if(EIGEN3_FOUND) - CGAL_target_use_Eigen(offset_meshing_plugin) +if(TARGET CGAL::Eigen_support) + target_link_libraries(offset_meshing_plugin PUBLIC CGAL::Eigen_support) endif() -if(TBB_FOUND) - CGAL_target_use_TBB(offset_meshing_plugin) +if(TARGET CGAL::TBB_support) + target_link_libraries(offset_meshing_plugin PUBLIC CGAL::TBB_support) endif() qt5_wrap_ui( shortestPathUI_FILES Shortest_path_widget.ui ) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index d8e2d1c3387..fa25ad50bf6 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -19,7 +19,8 @@ include_directories( ./ ) find_package(CGAL COMPONENTS Qt5) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.") return() endif() @@ -45,10 +46,9 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND ) add_file_dependencies( PCA_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) add_executable ( PCA_demo PCA_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - CGAL_target_use_Eigen(PCA_demo) target_link_libraries( PCA_demo PRIVATE - CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui) + CGAL::CGAL CGAL::CGAL_Qt5 CGAL::Eigen_support Qt5::Gui) add_to_cached_list( CGAL_EXECUTABLE_TARGETS PCA_demo ) diff --git a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt index acdc5826865..c5955afe2b4 100644 --- a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt @@ -12,14 +12,15 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) + include(CGAL_Eigen_support) # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program( "${cppfile}" ) - if (EIGEN3_FOUND) + if (TARGET CGAL::Eigen_support) get_filename_component(target ${cppfile} NAME_WE) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endif() endforeach() @@ -28,4 +29,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt index 02d5f28a0ac..236ac02b1be 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt @@ -12,14 +12,15 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) + include(CGAL_Eigen_support) # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program( "${cppfile}" ) - if (EIGEN3_FOUND) + if (TARGET CGAL::Eigen_support) get_filename_component(target ${cppfile} NAME_WE) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endif() endforeach() @@ -28,4 +29,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Property_map/examples/Property_map/CMakeLists.txt b/Property_map/examples/Property_map/CMakeLists.txt index d5717d3f5d2..5d251def5cf 100644 --- a/Property_map/examples/Property_map/CMakeLists.txt +++ b/Property_map/examples/Property_map/CMakeLists.txt @@ -33,9 +33,8 @@ endif() create_single_source_cgal_program( "dynamic_properties.cpp" ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) -if (EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "custom_property_map.cpp" ) - CGAL_target_use_Eigen(custom_property_map) + target_link_libraries(custom_property_map PUBLIC CGAL::Eigen_support) endif() - - diff --git a/Ridges_3/examples/Ridges_3/CMakeLists.txt b/Ridges_3/examples/Ridges_3/CMakeLists.txt index 9392ccb1b48..3fe086671df 100644 --- a/Ridges_3/examples/Ridges_3/CMakeLists.txt +++ b/Ridges_3/examples/Ridges_3/CMakeLists.txt @@ -10,7 +10,8 @@ if ( CGAL_FOUND ) # use either Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) # Link with Boost.ProgramOptions (optional) find_package(Boost QUIET COMPONENTS program_options) @@ -28,11 +29,11 @@ if ( CGAL_FOUND ) endif() create_single_source_cgal_program( Compute_Ridges_Umbilics.cpp) - CGAL_target_use_Eigen(Compute_Ridges_Umbilics) + target_link_libraries(Compute_Ridges_Umbilics PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( Ridges_Umbilics_SM.cpp) - CGAL_target_use_Eigen(Ridges_Umbilics_SM) + target_link_libraries(Ridges_Umbilics_SM PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( Ridges_Umbilics_LCC.cpp) - CGAL_target_use_Eigen(Ridges_Umbilics_LCC) + target_link_libraries(Ridges_Umbilics_LCC PUBLIC CGAL::Eigen_support) else() diff --git a/Ridges_3/test/Ridges_3/CMakeLists.txt b/Ridges_3/test/Ridges_3/CMakeLists.txt index 139ca8dfb10..95025861c1c 100644 --- a/Ridges_3/test/Ridges_3/CMakeLists.txt +++ b/Ridges_3/test/Ridges_3/CMakeLists.txt @@ -13,9 +13,10 @@ if ( CGAL_FOUND ) # use either Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "ridge_test.cpp" ) - CGAL_target_use_Eigen(ridge_test) + target_link_libraries(ridge_test PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") @@ -27,4 +28,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt index 4bfa4327eb0..de657c74d8f 100644 --- a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt @@ -6,9 +6,10 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package( TBB ) + include(CGAL_TBB_support) create_single_source_cgal_program( "cc_benchmark.cpp" ) - if(TBB_FOUND) - CGAL_target_use_TBB(cc_benchmark) + if(TARGET CGAL::TBB_support) + target_link_libraries(cc_benchmark PUBLIC CGAL::TBB_support) endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/STL_Extension/test/STL_Extension/CMakeLists.txt b/STL_Extension/test/STL_Extension/CMakeLists.txt index 80563069300..4a427003e02 100644 --- a/STL_Extension/test/STL_Extension/CMakeLists.txt +++ b/STL_Extension/test/STL_Extension/CMakeLists.txt @@ -12,6 +12,7 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package( TBB QUIET ) + include(CGAL_TBB_support) create_single_source_cgal_program( "test_Boolean_tag.cpp" ) create_single_source_cgal_program( "test_Cache.cpp" ) @@ -21,8 +22,8 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_composition.cpp" ) create_single_source_cgal_program( "test_Concatenate_iterator.cpp" ) create_single_source_cgal_program( "test_Concurrent_compact_container.cpp" ) - if(TBB_FOUND) - CGAL_target_use_TBB(test_Concurrent_compact_container) + if(TARGET CGAL::TBB_support) + target_link_libraries(test_Concurrent_compact_container PUBLIC CGAL::TBB_support) endif() create_single_source_cgal_program( "test_dispatch_output.cpp" ) create_single_source_cgal_program( "test_Flattening_iterator.cpp" ) @@ -43,12 +44,11 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_vector.cpp" ) create_single_source_cgal_program( "test_join_iterators.cpp" ) create_single_source_cgal_program( "test_for_each.cpp" ) - if(TBB_FOUND) - CGAL_target_use_TBB(test_for_each) + if(TARGET CGAL::TBB_support) + target_link_libraries(test_for_each PUBLIC CGAL::TBB_support) endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index e1bfb24bc41..b6b1e1a3ba1 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -13,26 +13,28 @@ if ( CGAL_FOUND ) if( ACTIVATE_CONCURRENCY ) find_package( TBB ) - if( NOT TBB_FOUND ) + include(CGAL_TBB_support) + if( NOT TARGET CGAL::TBB_support ) message( STATUS "NOTICE: Intel TBB NOT found! The example is faster if TBB is linked." ) endif() endif() find_package( Eigen3 3.1.0 ) - if( EIGEN3_FOUND ) + include(CGAL_Eigen_support) + if( TARGET CGAL::Eigen_support ) create_single_source_cgal_program( "scale_space.cpp" ) - CGAL_target_use_Eigen(scale_space) + target_link_libraries(scale_space PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "scale_space_incremental.cpp" ) - CGAL_target_use_Eigen(scale_space_incremental) + target_link_libraries(scale_space_incremental PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "scale_space_manifold.cpp" ) - CGAL_target_use_Eigen(scale_space_manifold) + target_link_libraries(scale_space_manifold PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "scale_space_advancing_front.cpp" ) - CGAL_target_use_Eigen(scale_space_advancing_front) - if(ACTIVATE_CONCURRENCY AND TBB_FOUND) - CGAL_target_use_TBB(scale_space) - CGAL_target_use_TBB(scale_space_incremental) - CGAL_target_use_TBB(scale_space_manifold) - CGAL_target_use_TBB(scale_space_advancing_front) + target_link_libraries(scale_space_advancing_front PUBLIC CGAL::Eigen_support) + if(ACTIVATE_CONCURRENCY AND TARGET CGAL::TBB_support) + target_link_libraries(scale_space PUBLIC CGAL::TBB_support) + target_link_libraries(scale_space_incremental PUBLIC CGAL::TBB_support) + target_link_libraries(scale_space_manifold PUBLIC CGAL::TBB_support) + target_link_libraries(scale_space_advancing_front PUBLIC CGAL::TBB_support) endif() else() message( STATUS "NOTICE: The example needs Eigen 3.1 (or greater) and will not be compiled." ) diff --git a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt index e89abfcbdf8..0e8d4b74cf0 100644 --- a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt +++ b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt @@ -14,13 +14,14 @@ if(CGAL_FOUND) # Use Eigen. find_package(Eigen3 3.1.0 QUIET) # (3.1.0 or greater) - if(EIGEN3_FOUND) + include(CGAL_Eigen_support) + if(TARGET CGAL::Eigen_support) create_single_source_cgal_program( "benchmark_region_growing_on_point_set_2.cpp") - CGAL_target_use_Eigen(benchmark_region_growing_on_point_set_2) + target_link_libraries(benchmark_region_growing_on_point_set_2 PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "benchmark_region_growing_on_point_set_3.cpp") - CGAL_target_use_Eigen(benchmark_region_growing_on_point_set_3) + target_link_libraries(benchmark_region_growing_on_point_set_3 PUBLIC CGAL::Eigen_support) endif() else() diff --git a/Shape_detection/examples/Shape_detection/CMakeLists.txt b/Shape_detection/examples/Shape_detection/CMakeLists.txt index be7c4667d6d..b012e3a0256 100644 --- a/Shape_detection/examples/Shape_detection/CMakeLists.txt +++ b/Shape_detection/examples/Shape_detection/CMakeLists.txt @@ -14,7 +14,8 @@ if(CGAL_FOUND) # Use Eigen. find_package(Eigen3 3.1.0 QUIET) # (3.1.0 or greater) - if(EIGEN3_FOUND) + include(CGAL_Eigen_support) + if(TARGET CGAL::Eigen_support) create_single_source_cgal_program( "efficient_RANSAC_basic.cpp") create_single_source_cgal_program( @@ -43,7 +44,7 @@ if(CGAL_FOUND) region_growing_on_polygon_mesh region_growing_with_custom_classes shape_detection_basic_deprecated) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() endif() diff --git a/Shape_detection/test/Shape_detection/CMakeLists.txt b/Shape_detection/test/Shape_detection/CMakeLists.txt index 2effc7dd265..b804d1014f2 100644 --- a/Shape_detection/test/Shape_detection/CMakeLists.txt +++ b/Shape_detection/test/Shape_detection/CMakeLists.txt @@ -14,6 +14,7 @@ if(CGAL_FOUND) # Use Eigen. find_package(Eigen3 3.1.0 QUIET) # (3.1.0 or greater) + include(CGAL_Eigen_support) if(EIGEN3_FOUND) create_single_source_cgal_program( "test_region_growing_basic.cpp") @@ -43,7 +44,7 @@ if(CGAL_FOUND) test_region_growing_on_point_set_3_with_sorting test_region_growing_on_polygon_mesh_with_sorting test_region_growing_on_degenerated_mesh) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() endif() diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index fbbea89f568..d6f2c10833a 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -12,32 +12,35 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) + include(CGAL_Eigen_support) - if (EIGEN3_FOUND) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "singular_value_decomposition.cpp" ) - CGAL_target_use_Eigen(singular_value_decomposition) + target_link_libraries(singular_value_decomposition PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "sparse_solvers.cpp" ) - CGAL_target_use_Eigen(sparse_solvers) + target_link_libraries(sparse_solvers PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "diagonalize_matrix.cpp" ) - CGAL_target_use_Eigen(diagonalize_matrix) + target_link_libraries(diagonalize_matrix PUBLIC CGAL::Eigen_support) endif() create_single_source_cgal_program( "mixed_integer_program.cpp" ) find_package( SCIP QUIET) + include(CGAL_SCIP_support) - if (SCIP_FOUND) + if (TARGET CGAL::SCIP_support) - CGAL_target_use_SCIP(mixed_integer_program) + target_link_libraries(mixed_integer_program PUBLIC CGAL::SCIP_support) message("SCIP found and used") else() - find_package( GLPK QUIET) + find_package( GLPK QUIET) + include(CGAL_GLPK_support) - if (GLPK_FOUND) + if (TARGET CGAL::GLPK_support) - CGAL_target_use_GLPK(mixed_integer_program) + target_link_libraries(mixed_integer_program PUBLIC CGAL::GLPK_support) message("GLPK found and used") else() @@ -54,4 +57,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt index 010a9bc992f..e2bb99bb3f6 100644 --- a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt @@ -13,6 +13,7 @@ if ( CGAL_FOUND ) include(${CGAL_USE_FILE}) find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) include_directories (BEFORE "include") @@ -45,7 +46,7 @@ find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) nn3nanoflan sizeof deque) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() else() @@ -53,4 +54,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt index a7e3bdd7983..37737a91826 100644 --- a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt @@ -18,6 +18,7 @@ if ( NOT CGAL_FOUND ) endif() find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) if (MSVC) # Turn off VC++ warning @@ -62,13 +63,13 @@ create_single_source_cgal_program( "weighted_Minkowski_distance.cpp" ) -if (EIGEN3_FOUND) +if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "fuzzy_range_query.cpp" ) - CGAL_target_use_Eigen(fuzzy_range_query) + target_link_libraries(fuzzy_range_query PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "general_neighbor_searching.cpp" ) - CGAL_target_use_Eigen(general_neighbor_searching) + target_link_libraries(general_neighbor_searching PUBLIC CGAL::Eigen_support) else() diff --git a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt index f865c8028c2..25197170b29 100644 --- a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt @@ -16,13 +16,12 @@ if ( CGAL_FOUND ) endforeach() find_package( TBB QUIET ) - if( TBB_FOUND ) - include( CGAL_target_use_TBB ) - CGAL_target_use_TBB( parallel_spatial_sort_3 ) + include(CGAL_TBB_support) + if( TARGET CGAL::TBB_support ) + target_link_libraries( parallel_spatial_sort_3 PUBLIC CGAL::TBB_support) endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt index 8213186a4b0..437508bf629 100644 --- a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt @@ -13,14 +13,13 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_multiscale.cpp" ) find_package (TBB QUIET) - if( TBB_FOUND ) - include( CGAL_target_use_TBB ) - CGAL_target_use_TBB( test_hilbert ) - endif( TBB_FOUND ) + include(CGAL_TBB_support) + if( TARGET CGAL::TBB_support ) + target_link_libraries( test_hilbert PUBLIC CGAL::TBB_support ) + endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt index aa73bcd3807..c73ab50c135 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt @@ -28,7 +28,8 @@ endif() # Use Eigen (for PCA) find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() @@ -39,20 +40,19 @@ endif() include( CGAL_CreateSingleSourceCGALProgram ) create_single_source_cgal_program( "vsa_approximation_2_example.cpp" ) -CGAL_target_use_Eigen(vsa_approximation_2_example) +target_link_libraries(vsa_approximation_2_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_approximation_example.cpp" ) -CGAL_target_use_Eigen(vsa_approximation_example) +target_link_libraries(vsa_approximation_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_class_interface_example.cpp" ) -CGAL_target_use_Eigen(vsa_class_interface_example) +target_link_libraries(vsa_class_interface_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_isotropic_metric_example.cpp" ) -CGAL_target_use_Eigen(vsa_isotropic_metric_example) +target_link_libraries(vsa_isotropic_metric_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_segmentation_example.cpp" ) -CGAL_target_use_Eigen(vsa_segmentation_example) +target_link_libraries(vsa_segmentation_example PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_simple_approximation_example.cpp" ) -CGAL_target_use_Eigen(vsa_simple_approximation_example) - +target_link_libraries(vsa_simple_approximation_example PUBLIC CGAL::Eigen_support) diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt index a41a41f1996..9548e5ac986 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt @@ -29,7 +29,8 @@ endif() # Use Eigen (for PCA) find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) -if (NOT EIGEN3_FOUND) +include(CGAL_Eigen_support) +if (NOT TARGET CGAL::Eigen_support) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() @@ -41,30 +42,28 @@ endif() include( CGAL_CreateSingleSourceCGALProgram ) create_single_source_cgal_program( "vsa_class_interface_test.cpp" ) -CGAL_target_use_Eigen(vsa_class_interface_test) +target_link_libraries(vsa_class_interface_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_correctness_test.cpp" ) -CGAL_target_use_Eigen(vsa_correctness_test) +target_link_libraries(vsa_correctness_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_error_decrease_test.cpp" ) -CGAL_target_use_Eigen(vsa_error_decrease_test) +target_link_libraries(vsa_error_decrease_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_kernel_test.cpp" ) -CGAL_target_use_Eigen(vsa_kernel_test) +target_link_libraries(vsa_kernel_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_approximation_test.cpp" ) -CGAL_target_use_Eigen(vsa_approximation_test) +target_link_libraries(vsa_approximation_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_segmentation_test.cpp" ) -CGAL_target_use_Eigen(vsa_segmentation_test) +target_link_libraries(vsa_segmentation_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_meshing_manifold_test.cpp" ) -CGAL_target_use_Eigen(vsa_meshing_manifold_test) +target_link_libraries(vsa_meshing_manifold_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_metric_test.cpp" ) -CGAL_target_use_Eigen(vsa_metric_test) +target_link_libraries(vsa_metric_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "vsa_teleportation_test.cpp" ) -CGAL_target_use_Eigen(vsa_teleportation_test) - - +target_link_libraries(vsa_teleportation_test PUBLIC CGAL::Eigen_support) diff --git a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt index b17f5995d32..daabda6ac44 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt @@ -17,9 +17,10 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "deform_mesh_for_botsch08_format.cpp" ) - CGAL_target_use_Eigen(deform_mesh_for_botsch08_format) + target_link_libraries(deform_mesh_for_botsch08_format PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: This program requires the Eigen library, version 3.2 or later and will not be compiled.") endif() @@ -28,4 +29,3 @@ else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt index ca146f90433..f60163d11be 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt @@ -12,7 +12,8 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "all_roi_assign_example.cpp" ) create_single_source_cgal_program( "all_roi_assign_example_custom_polyhedron.cpp" ) create_single_source_cgal_program( "all_roi_assign_example_Surface_mesh.cpp" ) @@ -31,15 +32,14 @@ if ( CGAL_FOUND ) k_ring_roi_translate_rotate_example k_ring_roi_translate_rotate_Surface_mesh deform_mesh_for_botsch08_format_sre_arap) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() find_package( OpenMesh QUIET ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) create_single_source_cgal_program( "all_roi_assign_example_with_OpenMesh.cpp" ) - target_link_libraries( all_roi_assign_example_with_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) - CGAL_target_use_Eigen(all_roi_assign_example_with_OpenMesh) + target_link_libraries( all_roi_assign_example_with_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} CGAL::Eigen_support) else() message(STATUS "Example that use OpenMesh will not be compiled.") endif() @@ -52,4 +52,3 @@ else() message(STATUS "NOTICE: These exmaples require the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt index 05da9a51cf7..624cef733bb 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt @@ -12,20 +12,20 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "Cactus_deformation_session.cpp" ) - CGAL_target_use_Eigen(Cactus_deformation_session) + target_link_libraries(Cactus_deformation_session PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "Cactus_performance_test.cpp" ) - CGAL_target_use_Eigen(Cactus_performance_test) + target_link_libraries(Cactus_performance_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "Symmetry_test.cpp" ) - CGAL_target_use_Eigen(Symmetry_test) + target_link_libraries(Symmetry_test PUBLIC CGAL::Eigen_support) find_package( OpenMesh QUIET ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) create_single_source_cgal_program( "Cactus_deformation_session_OpenMesh.cpp" ) - CGAL_target_use_Eigen(Cactus_deformation_session_OpenMesh) - target_link_libraries( Cactus_deformation_session_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) + target_link_libraries( Cactus_deformation_session_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} CGAL::Eigen_support) else() message(STATUS "Example that use OpenMesh will not be compiled.") endif() @@ -37,4 +37,3 @@ else() message(STATUS "NOTICE: These tests require the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 185aacb9503..eab97c84ecb 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -12,7 +12,8 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) # Executables that require Eigen 3.1 # ------------------------------------------------------------------ @@ -51,29 +52,28 @@ if ( CGAL_FOUND ) # ------------------------------------------------------------------ create_single_source_cgal_program( "discrete_authalic.cpp" ) - CGAL_target_use_Eigen(discrete_authalic) + target_link_libraries(discrete_authalic PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "lscm.cpp" ) - CGAL_target_use_Eigen(lscm) + target_link_libraries(lscm PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "orbifold.cpp" ) - CGAL_target_use_Eigen(orbifold) + target_link_libraries(orbifold PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "seam_Polyhedron_3.cpp" ) - CGAL_target_use_Eigen(seam_Polyhedron_3) + target_link_libraries(seam_Polyhedron_3 PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "simple_parameterization.cpp" ) - CGAL_target_use_Eigen(simple_parameterization) + target_link_libraries(simple_parameterization PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "square_border_parameterizer.cpp" ) - CGAL_target_use_Eigen(square_border_parameterizer) + target_link_libraries(square_border_parameterizer PUBLIC CGAL::Eigen_support) if(SuiteSparse_FOUND) target_link_libraries(orbifold PRIVATE ${SuiteSparse_LIBRARIES}) endif() - else(EIGEN3_FOUND) + else() message(STATUS "NOTICE: The examples require Eigen 3.1 (or greater) and will not be compiled.") - endif(EIGEN3_FOUND) + endif() else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt index 401f37978b4..7141d3fef9a 100644 --- a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt @@ -13,16 +13,16 @@ if ( CGAL_FOUND ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - if(EIGEN3_FOUND) + include(CGAL_Eigen_support) + if(TARGET CGAL::Eigen_support) create_single_source_cgal_program( "extensive_parameterization_test.cpp" ) - CGAL_target_use_Eigen(extensive_parameterization_test) - else(EIGEN3_FOUND) + target_link_libraries(extensive_parameterization_test PUBLIC CGAL::Eigen_support) + else() message(STATUS "NOTICE: The tests require Eigen 3.1 (or greater) and will not be compiled.") - endif(EIGEN3_FOUND) + endif() else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt index cb06fb9d434..bfd216d1e80 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt @@ -43,9 +43,10 @@ create_single_source_cgal_program( "edge_collapse_bounded_normal_change.cpp" ) create_single_source_cgal_program( "edge_collapse_visitor_surface_mesh.cpp" ) find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) -if( Eigen3_FOUND ) +include(CGAL_Eigen_support) +if( TARGET CGAL::Eigen_support ) create_single_source_cgal_program( "edge_collapse_garland_heckbert.cpp" ) - CGAL_target_use_Eigen(edge_collapse_garland_heckbert) + target_link_libraries(edge_collapse_garland_heckbert PUBLIC CGAL::Eigen_support) else () message(STATUS "Garland-Heckbert polices require the Eigen library, which has not been found; related examples will not be compiled.") endif() diff --git a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt index 0fb1f28c09d..b5522d61809 100644 --- a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt @@ -35,17 +35,17 @@ endif() # include for local package find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) +include(CGAL_Eigen_support) -if(NOT EIGEN3_FOUND) +if(NOT TARGET CGAL::Eigen_support) message(STATUS "NOTICE: Eigen 3.2 (or greater) is not found.") -endif(NOT EIGEN3_FOUND) +endif() # Creating entries for all .cpp/.C files with "main" routine # ########################################################## create_single_source_cgal_program( "solver_benchmark.cpp" ) -CGAL_target_use_Eigen(solver_benchmark) +target_link_libraries(solver_benchmark PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "mcf_scale_invariance.cpp" ) -CGAL_target_use_Eigen(mcf_scale_invariance) - +target_link_libraries(mcf_scale_invariance PUBLIC CGAL::Eigen_support) diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt index d3f29d30dc3..e5ee181c4d3 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt @@ -12,8 +12,9 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) + include(CGAL_Eigen_support) - if(EIGEN3_FOUND) + if(TARGET CGAL::Eigen_support) create_single_source_cgal_program( "simple_mcfskel_example.cpp" ) create_single_source_cgal_program( "simple_mcfskel_sm_example.cpp" ) create_single_source_cgal_program( "simple_mcfskel_LCC_example.cpp" ) @@ -29,7 +30,7 @@ if ( CGAL_FOUND ) MCF_Skeleton_sm_example MCF_Skeleton_LCC_example segmentation_example) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() else() message(STATUS "These programs require the Eigen library (3.2 or greater), and will not be compiled.") @@ -40,4 +41,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt index fd313cbf499..29adc5293fe 100644 --- a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt @@ -12,12 +12,13 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) + include(CGAL_Eigen_support) - if(EIGEN3_FOUND) + if(TARGET CGAL::Eigen_support) create_single_source_cgal_program( "MCF_Skeleton_test.cpp" ) - CGAL_target_use_Eigen(MCF_Skeleton_test) + target_link_libraries(MCF_Skeleton_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "skeleton_connectivity_test.cpp" ) - CGAL_target_use_Eigen(skeleton_connectivity_test) + target_link_libraries(skeleton_connectivity_test PUBLIC CGAL::Eigen_support) else() message(STATUS "These tests require the Eigen library (3.2 or greater), and will not be compiled.") endif() @@ -26,4 +27,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/TDS_3/test/TDS_3/CMakeLists.txt b/TDS_3/test/TDS_3/CMakeLists.txt index b21488fe951..87f0c8a318e 100644 --- a/TDS_3/test/TDS_3/CMakeLists.txt +++ b/TDS_3/test/TDS_3/CMakeLists.txt @@ -9,10 +9,11 @@ if ( CGAL_FOUND ) include_directories (BEFORE "./include") find_package( TBB QUIET ) + include(CGAL_TBB_support) create_single_source_cgal_program( "test_triangulation_tds_3.cpp" ) create_single_source_cgal_program( "test_io_tds3.cpp" ) - if(TBB_FOUND) - CGAL_target_use_TBB(test_triangulation_tds_3) + if(TARGET CGAL::TBB_support) + target_link_libraries(test_triangulation_tds_3 PUBLIC CGAL::TBB_support) endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Triangulation/applications/Triangulation/CMakeLists.txt b/Triangulation/applications/Triangulation/CMakeLists.txt index d185fab4fdc..1fc7365fd39 100644 --- a/Triangulation/applications/Triangulation/CMakeLists.txt +++ b/Triangulation/applications/Triangulation/CMakeLists.txt @@ -26,6 +26,7 @@ if ( NOT Boost_FOUND ) endif() find_package(Eigen3 3.1.0) +include(CGAL_Eigen_support) # include for local directory include_directories( BEFORE include ) @@ -36,8 +37,6 @@ include_directories( BEFORE include ) # ########################################################## create_single_source_cgal_program( "points_to_RT_to_off.cpp" ) -CGAL_target_use_Eigen(points_to_RT_to_off) +target_link_libraries(points_to_RT_to_off PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "points_to_DT_to_off.cpp" ) -CGAL_target_use_Eigen(points_to_DT_to_off) - - +target_link_libraries(points_to_DT_to_off PUBLIC CGAL::Eigen_support) diff --git a/Triangulation/benchmark/Triangulation/CMakeLists.txt b/Triangulation/benchmark/Triangulation/CMakeLists.txt index 0e03f970220..681ffd10bc0 100644 --- a/Triangulation/benchmark/Triangulation/CMakeLists.txt +++ b/Triangulation/benchmark/Triangulation/CMakeLists.txt @@ -14,12 +14,13 @@ if ( CGAL_FOUND ) include(${CGAL_USE_FILE}) find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) include_directories (BEFORE "include") create_single_source_cgal_program( "delaunay.cpp" ) - CGAL_target_use_Eigen(delaunay) + target_link_libraries(delaunay PUBLIC CGAL::Eigen_support) create_single_source_cgal_program( "Td_vs_T2_and_T3.cpp" ) - CGAL_target_use_Eigen(Td_vs_T2_and_T3) + target_link_libraries(Td_vs_T2_and_T3 PUBLIC CGAL::Eigen_support) else() message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.") @@ -28,4 +29,3 @@ if ( CGAL_FOUND ) else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Triangulation/examples/Triangulation/CMakeLists.txt b/Triangulation/examples/Triangulation/CMakeLists.txt index 7f8609612df..f6589b3e63a 100644 --- a/Triangulation/examples/Triangulation/CMakeLists.txt +++ b/Triangulation/examples/Triangulation/CMakeLists.txt @@ -17,7 +17,8 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) create_single_source_cgal_program( "barycentric_subdivision.cpp" ) create_single_source_cgal_program( "delaunay_triangulation.cpp" ) create_single_source_cgal_program( "convex_hull.cpp" ) @@ -34,7 +35,7 @@ if ( CGAL_FOUND ) triangulation triangulation_data_structure_dynamic triangulation_data_structure_static) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() else() message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.") @@ -45,4 +46,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Triangulation/test/Triangulation/CMakeLists.txt b/Triangulation/test/Triangulation/CMakeLists.txt index 2aed902c338..8dd9796ba23 100644 --- a/Triangulation/test/Triangulation/CMakeLists.txt +++ b/Triangulation/test/Triangulation/CMakeLists.txt @@ -15,7 +15,8 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + include(CGAL_Eigen_support) + if (TARGET CGAL::Eigen_support) include_directories (BEFORE "include") create_single_source_cgal_program( "test_triangulation.cpp" ) @@ -31,7 +32,7 @@ if ( CGAL_FOUND ) test_tds test_torture test_insert_if_in_star) - CGAL_target_use_Eigen(${target}) + target_link_libraries(${target} PUBLIC CGAL::Eigen_support) endforeach() else() @@ -41,4 +42,3 @@ if ( CGAL_FOUND ) else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt b/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt index c6892abd08e..4d0c7c1c778 100644 --- a/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt @@ -49,14 +49,12 @@ find_package(benchmark) if(TARGET benchmark::benchmark) find_package(TBB REQUIRED) - include( CGAL_target_use_TBB ) + include(CGAL_TBB_support) create_single_source_cgal_program( "DT3_benchmark_with_TBB.cpp" ) - CGAL_target_use_TBB(DT3_benchmark_with_TBB) - target_link_libraries(DT3_benchmark_with_TBB PRIVATE benchmark::benchmark) + target_link_libraries(DT3_benchmark_with_TBB PRIVATE benchmark::benchmark CGAL::TBB_support) add_executable(DT3_benchmark_with_TBB_CCC_approximate_size DT3_benchmark_with_TBB.cpp) - CGAL_target_use_TBB(DT3_benchmark_with_TBB_CCC_approximate_size) target_compile_definitions(DT3_benchmark_with_TBB_CCC_approximate_size PRIVATE CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE) - target_link_libraries(DT3_benchmark_with_TBB_CCC_approximate_size PRIVATE CGAL::CGAL benchmark::benchmark) + target_link_libraries(DT3_benchmark_with_TBB_CCC_approximate_size PRIVATE CGAL::CGAL benchmark::benchmark CGAL::TBB_support) endif() diff --git a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt index 99856041fc3..4b659999e15 100644 --- a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt @@ -37,12 +37,14 @@ option(CGAL_ACTIVATE_CONCURRENT_TRIANGULATION_3 if( CGAL_ACTIVATE_CONCURRENT_TRIANGULATION_3 ) add_definitions( -DCGAL_CONCURRENT_TRIANGULATION_3 ) find_package( TBB REQUIRED ) + include(CGAL_TBB_support) else( CGAL_ACTIVATE_CONCURRENT_TRIANGULATION_3 ) option( LINK_WITH_TBB "Link with TBB anyway so we can use TBB timers for profiling" ON) if( LINK_WITH_TBB ) find_package( TBB ) + find_package( TBB REQUIRED ) endif( LINK_WITH_TBB ) endif() @@ -67,8 +69,8 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) target_link_libraries( T3_demo PRIVATE CGAL::CGAL CGAL::CGAL_Qt5) target_link_libraries( T3_demo PRIVATE Qt5::OpenGL Qt5::Xml) - if(TBB_FOUND) - CGAL_target_use_TBB(T3_demo) + if(TARGET CGAL::TBB_support) + target_link_libraries(T3_demo PUBLIC CGAL::TBB_support) endif() include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index d6bd426e464..a44531dec74 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -39,16 +39,15 @@ if ( CGAL_FOUND ) endif() find_package( TBB QUIET ) + include(CGAL_TBB_support) - if( TBB_FOUND ) - include( CGAL_target_use_TBB ) - + if( TARGET CGAL::TBB_support ) create_single_source_cgal_program( "parallel_insertion_and_removal_in_regular_3.cpp" ) create_single_source_cgal_program( "parallel_insertion_in_delaunay_3.cpp" ) create_single_source_cgal_program( "sequential_parallel.cpp" ) - CGAL_target_use_TBB( parallel_insertion_and_removal_in_regular_3 ) - CGAL_target_use_TBB( parallel_insertion_in_delaunay_3 ) - CGAL_target_use_TBB( sequential_parallel ) + target_link_libraries( parallel_insertion_and_removal_in_regular_3 PUBLIC CGAL::TBB_support) + target_link_libraries( parallel_insertion_in_delaunay_3 PUBLIC CGAL::TBB_support ) + target_link_libraries( sequential_parallel PUBLIC CGAL::TBB_support) else() message(STATUS "NOTICE: a few examples require TBB and will not be compiled.") endif() @@ -58,4 +57,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index a2d10b47143..4dfcc8c4bb5 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -12,6 +12,7 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) find_package( TBB QUIET ) + include(CGAL_TBB_support) include_directories (BEFORE "include") @@ -30,12 +31,12 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_triangulation_3.cpp" ) create_single_source_cgal_program( "test_io_triangulation_3.cpp" ) - if(TBB_FOUND) + if(TARGET CGAL::TBB_support) foreach(target test_delaunay_3 test_regular_3 test_regular_insert_range_with_info) - CGAL_target_use_TBB(${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) endforeach() endif() @@ -54,4 +55,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() -