cmake_minimum_required(VERSION 3.12...3.31)
project(Constrained_triangulation_3_Examples)

find_package(CGAL REQUIRED COMPONENTS Qt6)

find_package(Eigen3 QUIET)
include(CGAL_Eigen3_support)

add_compile_definitions(QT_NO_KEYWORDS)

create_single_source_cgal_program(conforming_constrained_Delaunay_triangulation_3.cpp)
create_single_source_cgal_program(conforming_constrained_Delaunay_triangulation_3_fimap.cpp)
create_single_source_cgal_program(ccdt_3_from_soup.cpp)
create_single_source_cgal_program(ccdt_3_from_soup_fimap.cpp)
create_single_source_cgal_program(ccdt_3_after_autorefinement.cpp)
create_single_source_cgal_program(ccdt_3_preprocessing.cpp)
create_single_source_cgal_program(ccdt_3_check_preconditions.cpp)
create_single_source_cgal_program(remesh_constrained_Delaunay_triangulation_3.cpp)

if(TARGET CGAL::Eigen3_support)
  create_single_source_cgal_program(ccdt_3_fimap_region_growing.cpp)
  target_link_libraries(ccdt_3_fimap_region_growing PUBLIC CGAL::Eigen3_support)
endif()

if(CGAL_Qt6_FOUND)
  target_link_libraries(conforming_constrained_Delaunay_triangulation_3 PUBLIC CGAL::CGAL_Basic_viewer)
  target_link_libraries(ccdt_3_from_soup PUBLIC CGAL::CGAL_Basic_viewer)
  target_link_libraries(ccdt_3_from_soup_fimap PUBLIC CGAL::CGAL_Basic_viewer)
  target_link_libraries(ccdt_3_after_autorefinement PUBLIC CGAL::CGAL_Basic_viewer)
  target_link_libraries(ccdt_3_preprocessing PUBLIC CGAL::CGAL_Basic_viewer)
  target_link_libraries(ccdt_3_check_preconditions PUBLIC CGAL::CGAL_Basic_viewer)
else()
  message(STATUS "NOTICE: The example 'conforming_constrained_Delaunay_triangulation_3' cannot draw the result without Qt6.")
endif()

find_package(TBB QUIET)
include(CGAL_TBB_support)
if(TARGET CGAL::TBB_support)
  target_link_libraries(ccdt_3_from_soup_fimap PUBLIC CGAL::TBB_support)
endif()
