Simplify CGALConfig files: we do not need anymore to find zlib, nor opengl.

This commit is contained in:
Guillaume Damiand 2016-06-24 14:38:28 +02:00
parent 0fc00c87e3
commit c4758f091a
2 changed files with 23 additions and 84 deletions

View File

@ -127,62 +127,33 @@ macro(check_cgal_component COMPONENT)
if ( "${CGAL_LIB}" STREQUAL "CGAL" )
set( CGAL_FOUND TRUE )
set( CHECK_CGAL_ERROR_TAIL "" )
else()
else( "${CGAL_LIB}" STREQUAL "CGAL" )
if ( WITH_${CGAL_LIB} )
if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
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)
find_package(Qt5Core)
if(NOT Qt5Core_FOUND)
set( ${CGAL_LIB}_FOUND FALSE )
message(STATUS "Missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
message(STATUS "Missing the dependencies: Qt5Core cannot be configured.")
else()
set( ${CGAL_LIB}_FOUND TRUE )
if (CGAL_HEADER_ONLY)
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()
endif()
else()
else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
# Librairies that have no dependencies
set( ${CGAL_LIB}_FOUND TRUE )
endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
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." )
endif()
else()
endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
else( WITH_${CGAL_LIB} )
set( ${CGAL_LIB}_FOUND FALSE )
set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
endif()
endif()
endif( WITH_${CGAL_LIB} )
endif( "${CGAL_LIB}" STREQUAL "CGAL" )
if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" )

View File

@ -84,62 +84,30 @@ macro(check_cgal_component COMPONENT)
endif()
if ( WITH_${CGAL_LIB} )
if(TARGET CGAL::${CGAL_LIB} OR CGAL_HEADER_ONLY )
set( ${CGAL_LIB}_FOUND TRUE )
if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
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)
find_package(Qt5Core)
if(NOT Qt5Core_FOUND)
set( ${CGAL_LIB}_FOUND FALSE )
message(STATUS "Missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
message(STATUS "Missing the dependencies: Qt5Core cannot be configured.")
else()
set( ${CGAL_LIB}_FOUND TRUE )
if (CGAL_HEADER_ONLY)
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()
else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
# Librairies that have no dependencies
set( ${CGAL_LIB}_FOUND TRUE )
endif()
else()
endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
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." )
endif()
else()
endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
else( WITH_${CGAL_LIB} )
set( ${CGAL_LIB}_FOUND FALSE )
set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
endif()
endif( WITH_${CGAL_LIB} )
endif()
if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )