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!
A few CMakeLists.txt modify `CGAL_3RD_PARTY_LIBRARIES` to add Boost or
TBB libraries to it. In this case, emit a `DEPRECATION` warning and do
link with `${CGAL_3RD_PARTY_LIBRARIES}`.
Save the current source directory to `CGAL_CURRENT_SOURCE_DIR`. The
variable value is modified by a `CMakeLists.txt` file when it is
generated by `cgal_create_cmake_script` in the binary tree. The script
`cgal_create_cmake_script` itself it called by CMake, by the function
`process_CGAL_subdirectory` (see its definition in
`Installation/cmake/modules/CGAL_Macros.cmake`), called in
`(examples|test|demo)/CMakeLists.txt`.
Eventually, that variable value is supposed to be the directory to the
current sources, even if the current `CMakeLists.txt` is within the
binary tree.
That is used in `CGAL_CreateSingleSourceCGALProgram.cmake` for the CTest
support, so set correctly the current working directory (in the
directory of the tests/examples).
That is a late follow-up to the following commit:
| commit 12744ab7ff
| Author: Laurent Rineau <Laurent.Rineau__CGAL@normalesup.org>
| Date: Thu Apr 28 13:11:09 2011 +0000
|
| Track dependencies between libraries and examples/demos
|
| With this patch, when CGAL as been configured with WITH_examples and/or
| WITH_demos, then the executables of examples and demos depends on the CGAL
| libraries. That means if one change a file involved in a CGAL library, and
| ask the rebuild of an executable, then the CGAL library will be rebuilt
| first.
|
| Notes:
| r63187 branches/next
Or maybe the bug was re-introduced by recent modifications of our CMake
scripts.
removed almost all occurenced (missing UseFiles). While
doing so, some CMakeLists.txt could also be simplified. In fact
many more CMakeLists.txt can be simplified, in one of two ways:
1) add external libs to CGAL_3RD_PARTY_LIBRARIES and
2) call cgal_create_single_source_program
gcc has an option -isystem, that can replace -I. The documentation is:
-isystem dir
Search dir for header files, after all directories specified by -I but
before the standard system directories. Mark it as a system directory,
so that it gets the same special treatment as is applied to the
standard system directories. If dir begins with "=", then the "=" will
be replaced by the sysroot prefix; see --sysroot and -isysroot.
The "special treatment" means that gcc will not warn about constructions in
headers in directories pointed by -isystem instead of -I.
In the CGAL testsuite, there are a lot of warnings that comes from
third-party libraries (mostly from Boost, but also from Eigen).
This patch tells cmake to use -isystem with gcc, for all CGAL 3rd-party
directories.
CGAL_Boost_USE_STATIC_LIBS is now an (advanced) CMake option on all
platforms, and is stored in the generated CGALConfig.cmake. That way, its
value is proposed as the default value for the same option when programs
using CGAL are configured using CMake.
The script UseCGAL includes the module CGAL_TweakFindBoost, to define
Boost_USE_STATIC_LIBS and Boost_ADDITIONAL_VERSIONS.
With this patch, when CGAL as been configured with WITH_examples and/or
WITH_demos, then the executables of examples and demos depends on the CGAL
libraries. That means if one change a file involved in a CGAL library, and
ask the rebuild of an executable, then the CGAL library will be rebuilt
first.