New way to use the CGAL_Qt5 extra files

This commit is contained in:
Laurent Rineau 2016-09-09 20:16:00 +02:00
parent 6af02862de
commit 2daba815b3
3 changed files with 28 additions and 9 deletions

View File

@ -26,9 +26,9 @@ add_definitions(-DQT_NO_KEYWORDS)
# The executable itself.
add_executable( Constrained_Delaunay_triangulation_2
Constrained_Delaunay_triangulation_2.cpp ${CGAL_Qt5_extras})
Constrained_Delaunay_triangulation_2.cpp)
target_link_libraries( Constrained_Delaunay_triangulation_2
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Qt5_extras Qt5::Widgets)
target_include_directories( Constrained_Delaunay_triangulation_2
PRIVATE ./include)
@ -40,9 +40,9 @@ add_to_cached_list(CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2)
# The executable itself.
add_executable ( Delaunay_triangulation_2
Delaunay_triangulation_2.cpp ${CGAL_Qt5_extras})
Delaunay_triangulation_2.cpp)
target_link_libraries( Delaunay_triangulation_2
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Qt5_extras Qt5::Widgets)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
@ -52,8 +52,8 @@ add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
# The executable itself.
add_executable ( Regular_triangulation_2
Regular_triangulation_2.cpp ${CGAL_Qt5_extras})
Regular_triangulation_2.cpp)
target_link_libraries(Regular_triangulation_2
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Qt5_extras Qt5::Widgets)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Regular_triangulation_2 )

View File

@ -11,9 +11,7 @@ message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" )
include(Use_CGAL_Qt5_headers)
list(APPEND additional_files ${CGAL_Qt5_MOC_FILES} ${CGAL_Qt5_RESOURCE_FILES})
collect_cgal_library( CGAL_Qt5 "${additional_files}")
collect_cgal_library( CGAL_Qt5 "")
if(CGAL_HEADER_ONLY)
set(keyword "INTERFACE")
@ -21,6 +19,11 @@ endif()
CGAL_setup_CGAL_Qt5_dependencies( CGAL_Qt5 ${keyword})
if(NOT CGAL_HEADER_ONLY)
target_link_libraries( CGAL_Qt5 PRIVATE CGAL_Qt5_extras)
endif()
if(COMMAND add_config_flag)
set( CGAL_HAS_QT5 TRUE )
add_config_flag( CGAL_HAS_QT5 )

View File

@ -1,3 +1,8 @@
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
@ -13,3 +18,14 @@ qt5_add_resources (CGAL_Qt5_RESOURCE_FILES
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 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()