Fix our usage of TBB and <thread.h>

A lot of parts of CGAL use `<thread>` in conjunction with TBB. I have
added the `find_package(Threads)` in `CGAL_target_use_TBB.cmake` for
convenience.

I have also restored FindTBB.cmake as a pure copy of
  https://github.com/Kitware/VTK/blob/master/CMake/FindTBB.cmake
with that version:

> c7249fed2e73ce25fbbc53363d9caf4ab5cc9195
> Author: Cory Quammen <cory.quammen@kitware.com>
> Date:   Thu Feb 14 23:21:09 2019 -0500
>
>     FindTBB: handle basic linker scripts
>
>     TBB binaries may define libtbb.so as a linker script of the form
>
>     INPUT(libtbb.so.2)
>
>     Make FindTBB find the real .so file libtbb.so points to in such cases.
>
>     Approach borrowed from vtk-m/CMake/VTKmDeviceAdapters.cmake on
>     suggestion from Robert Maynard.
>
>
This commit is contained in:
Laurent Rineau 2019-07-24 10:35:36 +02:00
parent 82567685ad
commit a17c0d628d
4 changed files with 8 additions and 6 deletions

View File

@ -61,5 +61,6 @@ if( NOT CGAL_COMMON_FILE_INCLUDED )
# set use-file for Eigen3 (needed to have default solvers)
set(EIGEN3_USE_FILE "UseEigen3")
set(TBB_USE_FILE "UseTBB")
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake)
endif()

View File

@ -4,7 +4,9 @@ endif()
set(CGAL_target_use_TBB_included TRUE)
function(CGAL_target_use_TBB target)
target_include_directories ( ${target} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS} )
target_link_libraries( ${target} PUBLIC ${TBB_LIBRARIES} )
if(NOT TARGET Threads::Threads)
find_package(Threads REQUIRED)
endif()
target_link_libraries( ${target} PUBLIC TBB::tbb TBB::tbbmalloc Threads::Threads)
target_compile_options( ${target} PUBLIC -DNOMINMAX -DCGAL_LINKED_WITH_TBB )
endfunction()

View File

@ -419,6 +419,3 @@ if(NOT TBB_VERSION)
TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
endif()
set(TBB_USE_FILE "UseTBB")
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake)

View File

@ -140,6 +140,8 @@ include(${CGAL_MODULES_DIR}/CGAL_TweakFindBoost.cmake)
cgal_setup_module_path()
set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake)
set(TBB_USE_FILE "UseTBB")
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake)
include("${CGAL_MODULES_DIR}/CGAL_parse_version_h.cmake")
cgal_parse_version_h( "${CGAL_INSTALLATION_PACKAGE_DIR}/include/CGAL/version.h"