cmake_minimum_required(VERSION 3.1...3.15)
project( Triangulation_3_Examples )


if(NOT POLICY CMP0070 AND POLICY CMP0053)
  # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
  cmake_policy(SET CMP0053 OLD)
endif()

if(POLICY CMP0071)
  cmake_policy(SET CMP0071 NEW)
endif()

find_package(CGAL COMPONENTS Qt5)

if(CGAL_Qt5_FOUND)
    add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
endif()

if ( CGAL_FOUND )
  create_single_source_cgal_program( "for_loop.cpp" )
  create_single_source_cgal_program( "adding_handles_3.cpp" )
  create_single_source_cgal_program( "color.cpp" )
  create_single_source_cgal_program( "copy_triangulation_3.cpp" )
  create_single_source_cgal_program( "fast_location_3.cpp" )
  create_single_source_cgal_program( "find_conflicts_3.cpp" )
  create_single_source_cgal_program( "info_insert_with_pair_iterator.cpp" )
  create_single_source_cgal_program( "info_insert_with_pair_iterator_regular.cpp" )
  create_single_source_cgal_program( "info_insert_with_transform_iterator.cpp" )
  create_single_source_cgal_program( "info_insert_with_zip_iterator.cpp" )
  create_single_source_cgal_program( "regular_3.cpp" )
  create_single_source_cgal_program( "regular_with_info_3.cpp" )
  create_single_source_cgal_program( "simple_triangulation_3.cpp" )
  create_single_source_cgal_program( "simplex.cpp" )

  create_single_source_cgal_program("draw_triangulation_3.cpp")
  if(CGAL_Qt5_FOUND)
    target_link_libraries(draw_triangulation_3 PUBLIC CGAL::CGAL_Qt5)
  endif()

  find_package( TBB QUIET )

  if( TBB_FOUND )
    include( CGAL_target_use_TBB )

    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 )
  else()
    message(STATUS "NOTICE: a few examples require TBB and will not be compiled.")
  endif()

else()
  
    message(STATUS "This program requires the CGAL library, and will not be compiled.")
  
endif()

