add and use CGAL_ITK_support.cmake

This commit is contained in:
Jane Tournois 2021-10-26 14:04:27 +02:00 committed by Sébastien Loriot
parent b664ee54c3
commit 0498cace68
3 changed files with 11 additions and 5 deletions

View File

@ -0,0 +1,7 @@
if(ITK_FOUND AND NOT TARGET CGAL::ITK_support)
add_library(CGAL::ITK_support INTERFACE IMPORTED)
set_target_properties(CGAL::ITK_support PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_ITK"
INTERFACE_INCLUDE_DIRECTORIES "${ITK_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${ITK_LIBRARIES}")
endif()

View File

@ -164,10 +164,10 @@ if(TARGET CGAL::CGAL_ImageIO)
find_package(ITK QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity)
if(ITK_FOUND)
include(${ITK_USE_FILE})
include(CGAL_ITK_support)
create_single_source_cgal_program("mesh_3D_weighted_image.cpp")
target_link_libraries(mesh_3D_weighted_image
PUBLIC CGAL::Eigen3_support ${ITK_LIBRARIES})
PUBLIC CGAL::Eigen3_support CGAL::ITK_support)
endif(ITK_FOUND)
else()

View File

@ -30,9 +30,8 @@ target_include_directories(mesh_3_plugin PRIVATE include)
find_package(ITK QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity)
if(ITK_FOUND)
include(${ITK_USE_FILE})
target_link_libraries(mesh_3_plugin PUBLIC ${ITK_LIBRARIES})
target_compile_definitions(mesh_3_plugin PUBLIC CGAL_USE_ITK)
include(CGAL_ITK_support)
target_link_libraries(mesh_3_plugin PUBLIC CGAL::ITK_support)
endif(ITK_FOUND)
find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE)