Merge pull request #1309 from lrineau/CGAL-fix_HEADER_ONLY-lrineau

Hack to fix a bug with CGAL_HEADER_ONLY
This commit is contained in:
Laurent Rineau 2016-07-28 16:44:58 +02:00
commit 1c16ae9a52
1 changed files with 16 additions and 11 deletions

View File

@ -45,18 +45,23 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
endif()
if (NOT CGAL_HEADER_ONLY)
add_library (${LIBRARY_NAME}
${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp
${rc_file}
${ADDITIONAL_FILES})
# add_library (${LIBRARY_NAME} ${CGAL_LIBRARY_SOURCE_FILES} ${rc_file} ${ADDITIONAL_FILES}) # builing not creating temporary all_files.cpp
if(CGAL_SOVERSION AND CGAL_SONAME_VERSION)
set_target_properties(${LIBRARY_NAME} PROPERTIES
VERSION "${CGAL_SOVERSION}"
SOVERSION "${CGAL_SONAME_VERSION}")
endif()
add_library (${LIBRARY_NAME}
${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp
${rc_file}
${ADDITIONAL_FILES})
# add_library (${LIBRARY_NAME} ${CGAL_LIBRARY_SOURCE_FILES} ${rc_file} ${ADDITIONAL_FILES}) # builing not creating temporary all_files.cpp
if(CGAL_SOVERSION AND CGAL_SONAME_VERSION)
set_target_properties(${LIBRARY_NAME} PROPERTIES
VERSION "${CGAL_SOVERSION}"
SOVERSION "${CGAL_SONAME_VERSION}")
endif()
else()
add_library(${LIBRARY_NAME} INTERFACE)
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()
if(CGAL_AUTO_LINK_ENABLED)