mirror of https://github.com/CGAL/cgal
Merge pull request #171 from lrineau/Installation-fix_cmake_issues-lrineau
Fix find_package(CGAL COMPONENTS Qt5) when Qt5 is not configured
This commit is contained in:
commit
033d36f053
|
|
@ -12,7 +12,9 @@ get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
# The else condition of this code is intentionally not present in
|
# The else condition of this code is intentionally not present in
|
||||||
# CGALConfig_install.cmake.in since it cannot happen there.
|
# CGALConfig_install.cmake.in since it cannot happen there.
|
||||||
if(NOT CGAL_BUILDING_LIBS)
|
# Note also that for CMake<=2.8.11 (detected by the absence of CMP0024),
|
||||||
|
# the else() condition is never used.
|
||||||
|
if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS)
|
||||||
include("${CGAL_CONFIG_DIR}/CGALExports.cmake")
|
include("${CGAL_CONFIG_DIR}/CGALExports.cmake")
|
||||||
|
|
||||||
macro(CGAL_get_property_optional VAR TARGET PROPERTY)
|
macro(CGAL_get_property_optional VAR TARGET PROPERTY)
|
||||||
|
|
@ -43,7 +45,7 @@ else()
|
||||||
# targets are not imported and this is disallowed by CMP0026. Just
|
# targets are not imported and this is disallowed by CMP0026. Just
|
||||||
# set it to the target name.
|
# set it to the target name.
|
||||||
macro(CGAL_alias_library lib)
|
macro(CGAL_alias_library lib)
|
||||||
if(TARGET ${lib})
|
if(TARGET ${lib} AND NOT TARGET CGAL::${lib})
|
||||||
add_library(CGAL::${lib} ALIAS ${lib})
|
add_library(CGAL::${lib} ALIAS ${lib})
|
||||||
set(${lib}_LIBRARY CGAL::${lib})
|
set(${lib}_LIBRARY CGAL::${lib})
|
||||||
else()
|
else()
|
||||||
|
|
@ -117,10 +119,9 @@ set(CGAL_Qt5_3RD_PARTY_DEFINITIONS "@CGAL_Qt5_3RD_PARTY_DEFINITIONS@" )
|
||||||
set(CGAL_Qt5_3RD_PARTY_LIBRARIES_DIRS "@CGAL_Qt5_3RD_PARTY_LIBRARIES_DIRS@" )
|
set(CGAL_Qt5_3RD_PARTY_LIBRARIES_DIRS "@CGAL_Qt5_3RD_PARTY_LIBRARIES_DIRS@" )
|
||||||
set(CGAL_Qt5_3RD_PARTY_LIBRARIES "@CGAL_Qt5_3RD_PARTY_LIBRARIES@" )
|
set(CGAL_Qt5_3RD_PARTY_LIBRARIES "@CGAL_Qt5_3RD_PARTY_LIBRARIES@" )
|
||||||
|
|
||||||
|
|
||||||
set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
|
set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
|
||||||
|
|
||||||
set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
|
set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
|
||||||
|
|
||||||
set(CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "@CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT@")
|
set(CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "@CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT@")
|
||||||
|
|
||||||
|
|
@ -150,11 +151,16 @@ macro(check_cgal_component COMPONENT)
|
||||||
set( CHECK_CGAL_ERROR_TAIL "" )
|
set( CHECK_CGAL_ERROR_TAIL "" )
|
||||||
else()
|
else()
|
||||||
if ( WITH_${CGAL_LIB} )
|
if ( WITH_${CGAL_LIB} )
|
||||||
set( ${CGAL_LIB}_FOUND TRUE )
|
if(TARGET CGAL::${CGAL_LIB})
|
||||||
|
set( ${CGAL_LIB}_FOUND TRUE )
|
||||||
|
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." )
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set( ${CGAL_LIB}_FOUND FALSE )
|
set( ${CGAL_LIB}_FOUND FALSE )
|
||||||
|
set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
|
||||||
endif()
|
endif()
|
||||||
set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
|
if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
|
||||||
|
|
|
||||||
|
|
@ -124,11 +124,16 @@ macro(check_cgal_component COMPONENT)
|
||||||
set( CHECK_CGAL_ERROR_TAIL "" )
|
set( CHECK_CGAL_ERROR_TAIL "" )
|
||||||
else()
|
else()
|
||||||
if ( WITH_${CGAL_LIB} )
|
if ( WITH_${CGAL_LIB} )
|
||||||
set( ${CGAL_LIB}_FOUND TRUE )
|
if(TARGET CGAL::${CGAL_LIB})
|
||||||
|
set( ${CGAL_LIB}_FOUND TRUE )
|
||||||
|
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." )
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set( ${CGAL_LIB}_FOUND FALSE )
|
set( ${CGAL_LIB}_FOUND FALSE )
|
||||||
|
set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
|
||||||
endif()
|
endif()
|
||||||
set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
|
if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
|
||||||
|
|
|
||||||
|
|
@ -282,18 +282,18 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
|
||||||
# Nothing to add for Core
|
# Nothing to add for Core
|
||||||
|
|
||||||
if (${component} STREQUAL "ImageIO")
|
if (${component} STREQUAL "ImageIO")
|
||||||
find_package( OpenGL )
|
find_package( OpenGL QUIET )
|
||||||
find_package( ZLIB )
|
find_package( ZLIB QUIET )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${component} STREQUAL "Qt3")
|
if (${component} STREQUAL "Qt3")
|
||||||
find_package( OpenGL )
|
find_package( OpenGL QUIET )
|
||||||
find_package( Qt3-patched )
|
find_package( Qt3-patched QUIET )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${component} STREQUAL "Qt5")
|
if (${component} STREQUAL "Qt5")
|
||||||
find_package( OpenGL )
|
find_package( OpenGL QUIET )
|
||||||
find_package( Qt5 COMPONENTS OpenGL Svg)
|
find_package( Qt5 QUIET COMPONENTS OpenGL Svg )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else(WITH_CGAL_${component})
|
else(WITH_CGAL_${component})
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ macro(create_link_to_program COMPONENT )
|
||||||
if ( CGAL_AUTO_LINK_ENABLED )
|
if ( CGAL_AUTO_LINK_ENABLED )
|
||||||
target_link_libraries(link_to_${COMPONENT} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} )
|
target_link_libraries(link_to_${COMPONENT} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} )
|
||||||
else()
|
else()
|
||||||
target_link_libraries(link_to_${COMPONENT} ${${COMPONENT}_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} )
|
target_link_libraries(link_to_${COMPONENT} CGAL::${COMPONENT} ${CGAL_3RD_PARTY_LIBRARIES} ${${COMPONENT}_3RD_PARTY_LIBRARIES} )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
@ -70,9 +70,10 @@ if ( CGAL_FOUND )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( WITH_CGAL_Qt5 )
|
if ( WITH_CGAL_Qt5 )
|
||||||
find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
|
find_package(Qt5 QUIET)
|
||||||
if( Qt5_FOUND )
|
if( Qt5_FOUND )
|
||||||
create_link_to_program(CGAL_Qt5)
|
create_link_to_program(CGAL_Qt5)
|
||||||
|
qt5_use_modules(link_to_CGAL_Qt5)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue