If a `CMakeCache.txt ` is first created without `CGAL_HEADER_ONLY`, and
then `CGAL_HEADER_ONLY` is set, then CMake displays error messages like:
```
CMake Error: Target CGAL has dependency information when it shouldn't.
Your cache is probably stale. Please remove the entry
CGAL_LIB_DEPENDS
from the cache.
```
The problem comes from the fact that the target `CGAL` was first created as
a library target, and then turned into an "interface library" target.
This patch fixes the error the simplest way: remove the aforementioned
variable from the cache if it is present.
Add a CGALExports.cmake file
Conflicts:
GraphicsView/src/CGAL_Qt5/CMakeLists.txt
Installation/cmake/modules/CGALConfig_binary.cmake.in
Installation/cmake/modules/CGALConfig_install.cmake.in
There was also a conceptual conflict in:
Installation/src/CMakeLists.txt
Add an export-name to libraries created with collect_cgal_library and
use it in install(EXPORT). Fake the behavior of export(EXPORT) by
looking for created targets manually.
This caused a bug in CMake>=3.3.0 when file(GLOB) is not adding multiple
slashes. The lack of trailing slashes is guaranteed and documented in
get_filename_component.
Actually, in my opinion that was also a bug with other versions of
CMake.
Before this commit, in Installation/src, CGAL_CONFIGURED_LIBRARIES was
set to the empty string "" *in the parent scope* (Installation),
then the variable is modified in the current scope Installation/src, and
then the variable value is copied to a cache variable of the same name.
In my opinion, that means that the parent scope (Installation) has a
non-cache variable CGAL_CONFIGURED_LIBRARIES that is empty (""), and a
cache variable that is not empty (that contains, for example
"CGAL_Core;CGAL_Qt4;CGAL_ImageIO"). The document of CMake-3.0 precisely says
that the semantic of variables is such that cache variables have the
lowest priority. See:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#variables
As far as I know, that was supposed to be the same for CMake 2.8, but I
cannot find out where it is described in the documentation. Anyway, the
bug was visible with CMake 2.8 and not with CMake 3.0.
The patch simply does not set the empty value of
CGAL_CONFIGURED_LIBRARIES in the parent scope, but only in the current
local scope.
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.
The macro build_cgal_library(..) now defines the installation rules. That
should also fix a bug: now .dll files will be installed in
${CGAL_INSTALL_BIN_DIR}.