Fix compilation of demos in non-header-only

Now the variables `CGAL_Qt5_MOC_FILES` and `CGAL_Qt5_RESOURCE_FILES` are no
longer used by the definition of `CGAL_Qt5_extras`: other names are used.

`CGAL_Qt5_extras` is not supposed to be used directly by
users/examples/demos' `CMakeLists.txt`.
This commit is contained in:
Laurent Rineau 2017-11-22 12:45:21 +01:00
parent bc36af5eed
commit 19c5502ca8
7 changed files with 38 additions and 49 deletions

View File

@ -33,7 +33,7 @@ add_definitions(-DQT_NO_KEYWORDS)
add_executable( Constrained_Delaunay_triangulation_2
Constrained_Delaunay_triangulation_2.cpp)
target_link_libraries( Constrained_Delaunay_triangulation_2
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Qt5_extras Qt5::Widgets)
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
target_include_directories( Constrained_Delaunay_triangulation_2
PRIVATE ./include)
@ -47,7 +47,7 @@ add_to_cached_list(CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2)
add_executable ( Delaunay_triangulation_2
Delaunay_triangulation_2.cpp)
target_link_libraries( Delaunay_triangulation_2
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Qt5_extras Qt5::Widgets)
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
@ -59,7 +59,7 @@ add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
add_executable ( Regular_triangulation_2
Regular_triangulation_2.cpp)
target_link_libraries(Regular_triangulation_2
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Qt5_extras Qt5::Widgets)
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Regular_triangulation_2 )

View File

@ -14,13 +14,10 @@ endif()
message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" )
include(Use_CGAL_Qt5_headers)
if(NOT CGAL_HEADER_ONLY)
collect_cgal_library( CGAL_Qt5 "${CGAL_Qt5_MOC_FILES};${CGAL_Qt5_RESOURCE_FILES}")
collect_cgal_library( CGAL_Qt5 "${_CGAL_Qt5_MOC_FILES_private};${_CGAL_Qt5_RESOURCE_FILES_private}")
else()
collect_cgal_library( CGAL_Qt5 "")
target_link_libraries( CGAL_Qt5 INTERFACE CGAL_Qt5_extras)
endif()
if(CGAL_HEADER_ONLY)

View File

@ -129,9 +129,6 @@ macro(check_cgal_component COMPONENT)
message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
else()
set( CGAL_Qt5_FOUND TRUE )
if (CGAL_HEADER_ONLY)
include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake")
endif()
endif()
else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
# Librairies that have no dependencies

View File

@ -101,9 +101,6 @@ macro(check_cgal_component COMPONENT)
message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
else()
set( CGAL_Qt5_FOUND TRUE )
if (CGAL_HEADER_ONLY)
include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake")
endif()
endif()
else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
# Librairies that have no dependencies

View File

@ -0,0 +1,17 @@
if(CGAL_Qt5_moc_and_resource_files_included)
return()
endif()
set(CGAL_Qt5_moc_and_resource_files_included TRUE)
qt5_wrap_cpp(_CGAL_Qt5_MOC_FILES_private
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/DemosMainWindow.h
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewInput.h)
# qrc files (resources files, that contain icons, at least)
qt5_add_resources (_CGAL_Qt5_RESOURCE_FILES_private
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/CGAL.qrc
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Input.qrc
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/File.qrc
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Triangulation_2.qrc)

View File

@ -43,6 +43,20 @@ if(NOT OPENGL_FOUND)
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Qt5_moc_and_resource_files.cmake)
if(NOT TARGET CGAL_Qt5_extras)
add_library(CGAL_Qt5_extras STATIC ${_CGAL_Qt5_MOC_FILES_private} ${_CGAL_Qt5_RESOURCE_FILES_private})
set_target_properties(CGAL_Qt5_extras PROPERTIES
POSITION_INDEPENDENT_CODE TRUE
EXCLUDE_FROM_ALL TRUE)
target_link_libraries(CGAL_Qt5_extras CGAL::CGAL Qt5::Widgets Qt5::OpenGL Qt5::Svg)
add_library(CGAL::CGAL_Qt5_extras ALIAS CGAL_Qt5_extras)
add_library(CGAL::Qt5_extras ALIAS CGAL_Qt5_extras)
endif()
#.rst:
# Result Variables
# ^^^^^^^^^^^^^^^^
@ -92,7 +106,9 @@ function(CGAL_setup_CGAL_Qt5_dependencies target)
endif()
target_include_directories( ${target} SYSTEM ${keyword} ${OPENGL_INCLUDE_DIR})
target_link_libraries( ${target} ${keyword} CGAL::CGAL)
if(CGAL_HEADER_ONLY)
target_link_libraries( ${target} ${keyword} CGAL::Qt5_extras)
endif()
target_link_libraries( ${target} ${keyword} Qt5::OpenGL Qt5::Svg ${OPENGL_LIBRARIES})
endfunction()
include(${CMAKE_CURRENT_LIST_DIR}/Use_CGAL_Qt5_headers.cmake)

View File

@ -1,35 +0,0 @@
if(NOT CGAL_Qt5_FOUND)
return()
endif()
if(Use_CGAL_Qt5_headers_included)
return()
endif()
set(Use_CGAL_Qt5_headers_included TRUE)
qt5_wrap_cpp(CGAL_Qt5_MOC_FILES
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/DemosMainWindow.h
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewInput.h)
# qrc files (resources files, that contain icons, at least)
qt5_add_resources (CGAL_Qt5_RESOURCE_FILES
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/CGAL.qrc
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Input.qrc
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/File.qrc
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Triangulation_2.qrc)
set(CGAL_Qt5_extras)
list(APPEND CGAL_Qt5_extras ${CGAL_Qt5_MOC_FILES} ${CGAL_Qt5_RESOURCE_FILES})
if(NOT TARGET CGAL_Qt5_extras)
add_library(CGAL_Qt5_extras STATIC ${CGAL_Qt5_extras})
set_target_properties(CGAL_Qt5_extras PROPERTIES
POSITION_INDEPENDENT_CODE TRUE
EXCLUDE_FROM_ALL TRUE)
target_link_libraries(CGAL_Qt5_extras CGAL::CGAL Qt5::Widgets Qt5::OpenGL Qt5::Svg)
add_library(CGAL::CGAL_Qt5_extras ALIAS CGAL_Qt5_extras)
add_library(CGAL::Qt5_extras ALIAS CGAL_Qt5_extras)
endif()