Update cmakes in order to deal with install version of CGAL in header only mode.

This commit is contained in:
Guillaume Damiand 2016-06-21 11:20:28 +02:00
parent 374f5cc785
commit 1f40288aa3
3 changed files with 63 additions and 3 deletions

View File

@ -84,7 +84,14 @@ endif(CGAL_HEADER_ONLY)
collect_cgal_library( CGAL_Qt5 "${additional_files}")
if(CGAL_HEADER_ONLY)
set(CGAL_QT5_QTMOCCMAKE_FILES ${QTMOCCMAKE_FILES} CACHE INTERNAL "CGAL qt5 qtmoc cmake files")
FILE(GLOB files "../../include/CGAL/Qt/*")
install(FILES ${files} DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/include/CGAL/Qt/")
FILE(GLOB files "../../demo/resources/*")
install(FILES ${files} DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources")
FILE(GLOB files "../../demo/icons/*")
install(FILES ${files} DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons")
else()
qt5_use_modules(CGAL_Qt5 OpenGL Svg)

View File

@ -45,6 +45,7 @@ set(CGAL_ImageIO_USE_ZLIB "@CGAL_ImageIO_USE_ZLIB@" )
set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CGAL_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package")
if ( CGAL_FIND_REQUIRED )
set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE )
@ -85,6 +86,53 @@ macro(check_cgal_component COMPONENT)
if ( WITH_${CGAL_LIB} )
if(TARGET CGAL::${CGAL_LIB} OR CGAL_HEADER_ONLY )
set( ${CGAL_LIB}_FOUND TRUE )
if ("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
find_package(OpenGL QUIET)
find_package(Qt5 COMPONENTS OpenGL Svg QUIET)
set(CGAL_Qt5_MISSING_DEPS "")
if(NOT Qt5OpenGL_FOUND)
set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL")
endif()
if(NOT Qt5Svg_FOUND)
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg")
endif()
if(NOT Qt5_FOUND)
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
endif()
if(NOT OPENGL_FOUND)
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
endif()
if(CGAL_Qt5_MISSING_DEPS)
set( ${CGAL_LIB}_FOUND FALSE )
message(STATUS "Missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
else()
set( ${CGAL_LIB}_FOUND TRUE )
if (CGAL_HEADER_ONLY)
message("**************************** ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}")
include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake")
endif()
endif()
else()
if ("${CGAL_LIB}" STREQUAL "CGAL_ImageIO")
find_package( OpenGL QUIET )
find_package( ZLIB QUIET )
if(OPENGL_FOUND)
set( ${CGAL_LIB}_FOUND TRUE )
else(OPENGL_FOUND)
set( ${CGAL_LIB}_FOUND FALSE )
message(STATUS "Notice: ImageIO disabled because it requires OpenGL.")
endif(OPENGL_FOUND)
else()
# Librairies that have no dependencies
set( ${CGAL_LIB}_FOUND TRUE )
endif()
else()
# Librairies that have no dependencies
set( ${CGAL_LIB}_FOUND TRUE )
endif()
else()
set( ${CGAL_LIB}_FOUND FALSE )
set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." )

View File

@ -80,6 +80,9 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
install(EXPORT ${LIBRARY_NAME}Exports
DESTINATION "${CGAL_INSTALL_CMAKE_DIR}"
NAMESPACE CGAL::)
else()
# Create an empty file (install mode) in order to be able to load it later
file(WRITE "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}Exports.cmake" "")
endif()
# We have to call configure_file twice to force double expansion of variables.
@ -200,9 +203,11 @@ CGAL_add_if_target(CGAL_Core)
CGAL_add_if_target(CGAL_ImageIO)
CGAL_add_if_target(CGAL_Qt5)
#if (NOT CGAL_HEADER_ONLY) # TODO Check on windows these exports
if (NOT CGAL_HEADER_ONLY)
export(TARGETS ${CGAL_ACTUAL_CONFIGURED_LIBRARIES} NAMESPACE CGAL:: FILE "${CMAKE_BINARY_DIR}/CGALExports.cmake")
#endif()
else()
install(FILES "${CMAKE_BINARY_DIR}/CGALExports.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
endif()
message(STATUS "Sources for CGAL component libraries '${CGAL_CONFIGURED_LIBRARIES}' detected")