Better calls to find_package(Boost) for CGAL::CGAL_Core

This commit is contained in:
Laurent Rineau 2018-03-14 23:07:02 +01:00
parent 68a48e6b91
commit af6d9ab3bb
1 changed files with 21 additions and 4 deletions

View File

@ -53,6 +53,12 @@ endif()
# keyword, or ``PUBLIC`` otherwise. # keyword, or ``PUBLIC`` otherwise.
# #
# See the release notes of CGAL-4.10: CGAL_Core now requires
# Boost.Thread, with all compilers but MSVC.
if (NOT MSVC)
find_package( Boost 1.48 REQUIRED thread system )
endif()
function(CGAL_setup_CGAL_Core_dependencies target) function(CGAL_setup_CGAL_Core_dependencies target)
if(ARGV1 STREQUAL INTERFACE) if(ARGV1 STREQUAL INTERFACE)
set(keyword INTERFACE) set(keyword INTERFACE)
@ -60,13 +66,24 @@ function(CGAL_setup_CGAL_Core_dependencies target)
set(keyword PUBLIC) set(keyword PUBLIC)
endif() endif()
use_CGAL_GMP_support(CGAL_Core ${keyword})
target_compile_definitions(${target} ${keyword} CGAL_USE_CORE=1)
target_link_libraries( CGAL_Core ${keyword} CGAL::CGAL )
# See the release notes of CGAL-4.10: CGAL_Core now requires # See the release notes of CGAL-4.10: CGAL_Core now requires
# Boost.Thread, with all compilers but MSVC. # Boost.Thread, with all compilers but MSVC.
if (NOT MSVC) if (NOT MSVC)
find_package( Boost 1.48 REQUIRED thread system ) if(TARGET Boost::thread)
target_link_libraries( CGAL_Core ${keyword} Boost::thread)
else()
# Note that `find_package( Boost...)` must be called in the
# function `CGAL_setup_CGAL_Core_dependencies()` because the
# calling `CMakeLists.txt` may also call `find_package(Boost)`
# between the inclusion of this module, and the call to this
# function. That resets `Boost_LIBRARIES`.
find_package( Boost 1.48 REQUIRED thread system )
target_link_libraries( CGAL_Core ${keyword} ${Boost_LIBRARIES})
endif()
endif() endif()
use_CGAL_GMP_support(CGAL_Core ${keyword})
target_compile_definitions(${target} ${keyword} CGAL_USE_CORE=1)
target_link_libraries( CGAL_Core ${keyword} CGAL::CGAL ${Boost_LIBRARIES})
endfunction() endfunction()