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

find_package(CGAL REQUIRED)

# Use Eigen
find_package(Eigen3 QUIET)
include(CGAL_Eigen3_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 TARGET CGAL::Eigen3_support)
    get_filename_component(target ${cppfile} NAME_WE)
    create_single_source_cgal_program(${cppfile})
    if(TARGET CGAL::Eigen3_support)
      target_link_libraries(${target} PRIVATE CGAL::CGAL CGAL::Eigen3_support)
    else()
      target_link_libraries(${target} PRIVATE CGAL::CGAL)
    endif()
  endif()
endforeach()
