More CMakeLists Updates for QT6

This commit is contained in:
Nicolas Saillant 2023-09-11 09:51:06 +02:00
parent 0303b8dfd5
commit a4136707b2
6 changed files with 17 additions and 60 deletions

View File

@ -5,7 +5,7 @@ project(Generator_Demo)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)
find_package(Qt6 QUIET COMPONENTS Widgets OpenGLWidgets)
find_package(Qt6 QUIET COMPONENTS Widgets)
if(CGAL_Qt6_FOUND AND Qt6_FOUND)

View File

@ -4,20 +4,11 @@
cmake_minimum_required(VERSION 3.1...3.23)
project(Periodic_3_triangulation_3_Demo)
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Find CGAL
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)
# Find Qt6 itself
find_package(Qt6 QUIET COMPONENTS Widgets OpenGL OpenGLWidgets Help ToolsTools)
find_package(Qt6 QUIET COMPONENTS Widgets OpenGL Help ToolsTools)
if(Qt6_FOUND)
add_definitions(-DQT_NO_KEYWORDS)
@ -30,11 +21,9 @@ if(CGAL_Qt6_FOUND
AND Qt6_FOUND
AND TARGET ${CGAL_QCOLLECTIONGENERATOR_TARGET})
# UI files (Qt Designer files)
qt6_wrap_ui(UI_FILES MainWindow.ui)
# qrc files (resource files)
qt6_add_resources(CGAL_Qt6_RESOURCE_FILES ./Periodic_3_triangulation_3.qrc)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# use the Qt MOC preprocessor on classes that derive from QObject
qt6_generate_moc("Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Scene.cpp")
@ -52,7 +41,7 @@ if(CGAL_Qt6_FOUND
${CMAKE_CURRENT_BINARY_DIR}/Periodic_3_triangulation_3.qhc)
# The executable itself
add_executable(
qt_add_executable(
periodic_3_triangulation_3_demo
Scene.cpp
moc_Scene.cpp
@ -61,9 +50,6 @@ if(CGAL_Qt6_FOUND
periodic_3_triangulation_3_demo.cpp
MainWindow.ui
moc_MainWindow.cpp
${UI_FILES}
${CGAL_Qt6_RESOURCE_FILES}
${CGAL_Qt6_MOC_FILES}
Periodic_3_triangulation_3.qhc)
add_to_cached_list(CGAL_EXECUTABLE_TARGETS periodic_3_triangulation_3_demo)

View File

@ -4,14 +4,6 @@
cmake_minimum_required(VERSION 3.1...3.23)
project(Periodic_Lloyd_3_Demo)
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
@ -19,7 +11,7 @@ set(CMAKE_AUTOMOC ON)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)
find_package(Qt6 QUIET COMPONENTS Widgets OpenGL OpenGLWidgets Help ToolsTools)
find_package(Qt6 QUIET COMPONENTS Widgets OpenGL Help ToolsTools)
set(CGAL_QCOLLECTIONGENERATOR_TARGET Qt6::qhelpgenerator)
@ -29,11 +21,8 @@ if(CGAL_Qt6_FOUND
include_directories(BEFORE ./)
# ui file, created with Qt Designer
qt6_wrap_ui(uis MainWindow.ui)
# qrc files (resources files, that contain icons, at least)
qt6_add_resources(CGAL_Qt6_RESOURCE_FILES ./Periodic_Lloyd_3.qrc)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
if(DEFINED QT_QCOLLECTIONGENERATOR_EXECUTABLE)
@ -51,15 +40,13 @@ if(CGAL_Qt6_FOUND
${CMAKE_CURRENT_BINARY_DIR}/Periodic_Lloyd_3.qhc
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_executable(
qt_add_executable(
Periodic_Lloyd_3
Periodic_Lloyd_3.qhc
Periodic_Lloyd_3.cpp
MainWindow.cpp
Viewer.cpp
${uis}
${CGAL_Qt6_RESOURCE_FILES}
${CGAL_Qt6_MOC_FILES})
Periodic_Lloyd_3.qrc)
add_to_cached_list(CGAL_EXECUTABLE_TARGETS Periodic_Lloyd_3)

View File

@ -20,14 +20,11 @@ if((CGAL_Core_FOUND OR LEDA_FOUND)
include_directories(BEFORE include)
# ui files, created with Qt Designer
qt6_wrap_ui(UIS P4HDT2.ui)
# qrc files (resources files, that contain icons, at least)
qt6_add_resources(RESOURCE_FILES Main_resources.qrc)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# cpp files
add_executable(P4HDT2 P4HDT2.cpp ${RESOURCE_FILES} ${UIS})
qt_add_executable(P4HDT2 P4HDT2.cpp P4HDT2.ui)
target_link_libraries(P4HDT2 PRIVATE CGAL::CGAL CGAL::CGAL_Qt6 Qt6::Widgets)
if(TARGET CGAL::CGAL_Core)

View File

@ -17,8 +17,6 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# The executable itself.
qt_add_executable(
Polyline_simplification_2
Polyline_simplification_2.cpp Polyline_simplification_2.ui Polyline_simplification_2.qrc)

View File

@ -11,20 +11,12 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Find CGAL and CGAL Qt6
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)
# Find Qt6 itself
find_package(Qt6 QUIET COMPONENTS Widgets OpenGLWidgets OpenGL)
find_package(Qt6 QUIET COMPONENTS Widgets OpenGL)
find_package(Eigen3 3.1.0 QUIET) #(requires 3.1.0 or greater)
include(CGAL_Eigen3_support)
@ -33,12 +25,9 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND AND TARGET CGAL::Eigen3_support)
# Include this package's headers first
include_directories(BEFORE ./ ./include)
# ui file, created with Qt Designer
qt6_wrap_ui( uis Mainwindow.ui )
set(CMAKE_AUTOUIC ON)
#qt6_generate_moc( main.cpp Mainwindow.moc)
add_executable ( Triangulation_on_sphere_2_Demo main.cpp Viewer.cpp ${uis})
qt_add_executable ( Triangulation_on_sphere_2_Demo main.cpp Viewer.cpp)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Triangulation_on_sphere_2_Demo )