diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 2d9617e447a..84225f4718d 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -102,6 +102,16 @@ function(CGAL_setup_CGAL_dependencies target) target_include_directories(${target} INTERFACE $) + # Make CGAL depend on threads-support (for Epeck and Epeck_d) + if(CGAL_HAS_NO_THREADS) + target_compile_definitions(${target} INTERFACE CGAL_HAS_NO_THREADS) + else() + if(NOT TARGET Threads::Threads) + find_package(Threads REQUIRED) + endif() + target_link_libraries(${target} INTERFACE Threads::Threads) + endif() + # Now setup compilation flags if(MSVC) target_compile_options(${target} INTERFACE @@ -144,14 +154,6 @@ function(CGAL_setup_CGAL_dependencies target) if ( RUNNING_CGAL_AUTO_TEST ) target_compile_options(${target} INTERFACE "-Wall") endif() - if(CGAL_HAS_NO_THREADS) - target_compile_definitions(${target} INTERFACE CGAL_HAS_NO_THREADS) - else() - if(NOT TARGET Threads::Threads) - find_package(Threads REQUIRED) - endif() - target_link_libraries(${target} INTERFACE Threads::Threads) - endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) message( STATUS "Using gcc version 4 or later. Adding -frounding-math" ) if(CMAKE_VERSION VERSION_LESS 3.3)