Hack to fix a bug with CGAL_HEADER_ONLY

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.
This commit is contained in:
Laurent Rineau 2016-07-28 16:36:42 +02:00
parent b9465c31ec
commit acf339d27f
1 changed files with 5 additions and 0 deletions

View File

@ -56,6 +56,11 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
SOVERSION "${CGAL_SONAME_VERSION}")
endif()
else()
if(${LIBRARY_NAME}_LIB_DEPENDS)
# Fix a bug when CGAL is configured first without `CGAL_HEADER_ONLY`
# and then `CGAL_HEADER_ONLY` is set without cleaning the cache.
unset(${LIBRARY_NAME}_LIB_DEPENDS CACHE)
endif()
add_library(${LIBRARY_NAME} INTERFACE)
endif()