```
== CMake setup ==
CMake Warning (dev) at Installation/lib/cmake/CGAL/CGALConfigVersion.cmake:6 (set):
Cannot set "CGAL_MAJOR_VERSION": current scope has no parent.
Call Stack (most recent call first):
CGALConfigVersion.cmake:1 (include)
CMakeLists.txt:13 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
```
When an installed header-only version of CGAL is used, and when all
`demo/*` are configured at once, then only the first demo got
`CGAL_Qt5_FOUND` correctly set.
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.
>
>
The previous installed version of `CGALConfig.cmake`, when
`CGAL_HEADER_ONLY` is true, was hard-coding a path `../../../`,
relative to the location of itself. It might be that the CMake modules
are not installed in a sub-directory with three components, relatively
to the prefix.
That way of doing it buggy. And that triggered issue with the cgal
port in vcpkg:
https://github.com/Microsoft/vcpkg/pull/5734
This patch is just another hack: it hardcodes that the relative path
can be any of:
- `../`,
- `../../`, or
- `../../../`.
In header-only, `CGALConfig.cmake` constructs the path to the root of
the CGAL installation. It used to use `../` a lot, to go back in
parent directories, but:
- that was... ugly,
- and Ninja saw a problem with that (a warning about the path to
`print_GMP_version.cpp`).
`CGALConfig.cmake` Now uses the CMake command `get_filename_component`.
The pull-request https://github.com/CGAL/cgal/pull/3413 has introduced
a side-effect: CTest was broken when `CGAL_HEADER_ONLY=OFF`, for all
tests using a `.cin` or `.cmd` file. That is due to the variable
`CGAL_CURRENT_SOURCE_DIR` that was only filled by `UseCGAL.cmake`.
Now that we forbid CGAL directories without `CMakeLists.txt`, that
variable `CGAL_CURRENT_SOURCE_DIR` is now useless, and can be removed:
`CMAKE_CURRENT_SOURCE_DIR` is sufficient. That fixes the bug with
CTest, and also makes the CMake code a bit simpler.