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.
When a user-project is compile from a Git repository, there was that
annoying warning about the project not being developed in the same branch
as CGAL itself!
In the testsuite, with `RUNNING_CGAL_AUTO_TEST`, the message will end with:
> Set CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE to TRUE if you want to
> disable this notice.
instead of
> disable this warning.
Because otherwise our test results are full of yellow 'w' (warnings).
When CGAL_Qt5 or CGAL_Core targets are imported, then we need to call
`find_package(Qt5)` and `find_package(Boost)` to re-import the
targets of Qt5 or `Boost::thread`.
Otherwise, there is that CMake warning:
CMake Warning (dev) at /mnt/testsuite/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake:49 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "test_Min_circle" links to target "Boost::thread" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
Call Stack (most recent call first):
CMakeLists.txt:22 (create_single_source_cgal_program)
This warning is for project developers. Use -Wno-dev to suppress it.
and then that link error:
/usr/bin/ld: cannot find -lBoost::thread
Ref:
https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-4.12-Ic-200/Bounding_volumes/TestReport_lrineau_Fedora-Release.gz
When `CGAL_HEADER_ONLY` and `WITH_{examples|tests|demos}`, then only
the first call to `find_package(CGAL)` does the job. The subsequent
calls return very fast, by caching the results in global properties.
When `WITH_{examples|demos|tests}` is `ON`, `CGAL_SCM.cmake` is
included by each sub-directory. With this patch, the values of
`CGAL_SCM_BRANCH_NAME` and `CGAL_CREATED_GIT_HASH` are stored in
global properties, and retrieved, instead of forking two `git` at each
use of the module.
Fix the issue "CMake error when WITH_CGAL_Qt5 is set to ON then
OFF" (#1580).
The previous CMake code was using a `file(GLOB)` to discover the list
of configured libraries, whereas that list is known by CMake.