aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-11-29 14:42:24 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-11-29 21:10:14 +0000
commita2d56c9fb19ab163ace79babe64578c4e1536bb3 (patch)
treedbf5cebc58cbca964ab2a6cd0468d3649a30bcba
parent4c1618d7ef8da5d4b45f29346ba6a1c7d34bce29 (diff)
Build system: Use modern form of finding and linking Qt libraries
Task-number: PYSIDE-962 Change-Id: I91aed62a8e14bbc1101b4f23e25f57a5d6bca173 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c199b64bcbcaeb55ce78ce3f4e772fcdc68073f4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/scriptableapplication/CMakeLists.txt4
-rw-r--r--examples/widgetbinding/CMakeLists.txt4
-rw-r--r--sources/pyside6/CMakeLists.txt2
-rw-r--r--sources/pyside6/cmake/PySideSetup.cmake6
-rw-r--r--sources/pyside6/plugins/designer/CMakeLists.txt5
-rw-r--r--sources/pyside6/plugins/uitools/CMakeLists.txt5
-rw-r--r--sources/pyside6/tests/pysidetest/CMakeLists.txt11
-rw-r--r--sources/shiboken6/ApiExtractor/CMakeLists.txt5
-rw-r--r--sources/shiboken6/ApiExtractor/tests/CMakeLists.txt2
-rw-r--r--sources/shiboken6/cmake/ShibokenSetup.cmake2
-rw-r--r--sources/shiboken6/generator/CMakeLists.txt2
-rw-r--r--sources/shiboken6/tests/dumpcodemodel/CMakeLists.txt2
12 files changed, 17 insertions, 33 deletions
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index af6d11a27..e9c19dc30 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -12,9 +12,7 @@ project(scriptableapplication)
set(CMAKE_CXX_STANDARD 17)
# Find required Qt packages.
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS Core Gui Widgets)
# Use provided python interpreter if given.
if(NOT python_interpreter)
diff --git a/examples/widgetbinding/CMakeLists.txt b/examples/widgetbinding/CMakeLists.txt
index 4f110f57e..909208e3a 100644
--- a/examples/widgetbinding/CMakeLists.txt
+++ b/examples/widgetbinding/CMakeLists.txt
@@ -16,9 +16,7 @@ project(wiggly LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS Core Gui Widgets)
# ================================ General configuration ======================================
diff --git a/sources/pyside6/CMakeLists.txt b/sources/pyside6/CMakeLists.txt
index 7dd242828..f73133fa1 100644
--- a/sources/pyside6/CMakeLists.txt
+++ b/sources/pyside6/CMakeLists.txt
@@ -16,7 +16,7 @@ endif()
if(Qt${QT_MAJOR_VERSION}UiTools_FOUND)
add_subdirectory(plugins/uitools)
- find_package(Qt${QT_MAJOR_VERSION}Designer)
+ find_package(Qt6 COMPONENTS Designer)
# PYSIDE-535: Enable when PyPy supports embedding
if (Qt${QT_MAJOR_VERSION}Designer_FOUND AND NOT PYPY_VERSION)
add_subdirectory(plugins/designer)
diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake
index 43d042aef..a4ec74d44 100644
--- a/sources/pyside6/cmake/PySideSetup.cmake
+++ b/sources/pyside6/cmake/PySideSetup.cmake
@@ -90,7 +90,7 @@ if(QFP_QT_HOST_PATH)
endif()
endif()
endif()
-find_package(Qt${QT_MAJOR_VERSION} 6.0 REQUIRED COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
add_definitions(${Qt${QT_MAJOR_VERSION}Core_DEFINITIONS})
@@ -177,7 +177,7 @@ foreach(m ${DISABLED_MODULES})
endforeach()
# Whether to add libpysideqml
-find_package(Qt${QT_MAJOR_VERSION}Qml)
+find_package(Qt6 COMPONENTS Qml)
string(REGEX MATCHALL "[0-9]+" qt_version_helper "${Qt${QT_MAJOR_VERSION}Core_VERSION}")
@@ -227,5 +227,5 @@ if(SANITIZE_ADDRESS AND NOT MSVC)
setup_sanitize_address()
endif()
-find_package(Qt${QT_MAJOR_VERSION}Designer)
+find_package(Qt6 COMPONENTS Designer)
diff --git a/sources/pyside6/plugins/designer/CMakeLists.txt b/sources/pyside6/plugins/designer/CMakeLists.txt
index 50074be51..f1b7f83b3 100644
--- a/sources/pyside6/plugins/designer/CMakeLists.txt
+++ b/sources/pyside6/plugins/designer/CMakeLists.txt
@@ -7,10 +7,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
+find_package(Qt6 COMPONENTS Core Gui Widgets UiPlugin)
qt_add_plugin(PySidePlugin)
diff --git a/sources/pyside6/plugins/uitools/CMakeLists.txt b/sources/pyside6/plugins/uitools/CMakeLists.txt
index ee56cfa2c..b6e6502d2 100644
--- a/sources/pyside6/plugins/uitools/CMakeLists.txt
+++ b/sources/pyside6/plugins/uitools/CMakeLists.txt
@@ -4,10 +4,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
+find_package(Qt6 COMPONENTS Core Gui Widgets UiPlugin)
set(ui_plugin_src
customwidgets.cpp
diff --git a/sources/pyside6/tests/pysidetest/CMakeLists.txt b/sources/pyside6/tests/pysidetest/CMakeLists.txt
index d0932509e..3965455c9 100644
--- a/sources/pyside6/tests/pysidetest/CMakeLists.txt
+++ b/sources/pyside6/tests/pysidetest/CMakeLists.txt
@@ -14,7 +14,7 @@ set(CMAKE_AUTOMOC ON)
add_definitions(-DQT_SHARED)
add_definitions(-DRXX_ALLOCATOR_INIT_0)
-find_package(Qt${QT_MAJOR_VERSION}Widgets)
+find_package(Qt6 COMPONENTS QtWidgets)
set(pysidetest_SRC
containertest.cpp
@@ -110,10 +110,7 @@ set_target_properties(pysidetest PROPERTIES
target_link_libraries(pysidetest
Shiboken6::libshiboken
- ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
- )
+ Qt::Core Qt::Gui Qt::Widgets)
add_library(testbinding MODULE ${testbinding_SRC})
set_property(TARGET testbinding PROPERTY PREFIX "")
@@ -126,9 +123,7 @@ target_link_libraries(testbinding
pysidetest
pyside6
Shiboken6::libshiboken
- ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES})
+ Qt::Core Qt::Gui Qt::Widgets)
add_dependencies(testbinding pyside6 QtCore QtGui QtWidgets pysidetest)
create_generator_target(testbinding)
diff --git a/sources/shiboken6/ApiExtractor/CMakeLists.txt b/sources/shiboken6/ApiExtractor/CMakeLists.txt
index 936def4a0..f3337edc8 100644
--- a/sources/shiboken6/ApiExtractor/CMakeLists.txt
+++ b/sources/shiboken6/ApiExtractor/CMakeLists.txt
@@ -52,7 +52,6 @@ parser/enumvalue.cpp
xmlutils.cpp
)
-find_package(Qt${QT_MAJOR_VERSION}Xml 6.0)
find_package(LibXml2 2.6.32)
find_package(LibXslt 1.1.19)
@@ -75,7 +74,7 @@ target_include_directories(apiextractor PRIVATE ${CLANG_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/parser)
-target_link_libraries(apiextractor PUBLIC Qt${QT_MAJOR_VERSION}::Core)
+target_link_libraries(apiextractor PUBLIC Qt::Core)
target_link_libraries(apiextractor PRIVATE libclang)
if (HAS_LIBXSLT)
@@ -100,7 +99,7 @@ target_compile_definitions(apiextractor
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
if (BUILD_TESTS)
- find_package(Qt${QT_MAJOR_VERSION}Test 6.0 REQUIRED)
+ find_package(Qt6 REQUIRED COMPONENTS Test)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/tests)
enable_testing()
add_subdirectory(tests)
diff --git a/sources/shiboken6/ApiExtractor/tests/CMakeLists.txt b/sources/shiboken6/ApiExtractor/tests/CMakeLists.txt
index 97ae0f850..8abc88d6f 100644
--- a/sources/shiboken6/ApiExtractor/tests/CMakeLists.txt
+++ b/sources/shiboken6/ApiExtractor/tests/CMakeLists.txt
@@ -15,7 +15,7 @@ macro(declare_test testname)
${CMAKE_CURRENT_BINARY_DIR}
${apiextractor_SOURCE_DIR}
)
- target_link_libraries(${testname} PRIVATE apiextractor Qt${QT_MAJOR_VERSION}::Test)
+ target_link_libraries(${testname} PRIVATE apiextractor Qt::Test)
add_test(${testname} ${testname})
if (INSTALL_TESTS)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${testname}
diff --git a/sources/shiboken6/cmake/ShibokenSetup.cmake b/sources/shiboken6/cmake/ShibokenSetup.cmake
index 703a72258..6f37ecc67 100644
--- a/sources/shiboken6/cmake/ShibokenSetup.cmake
+++ b/sources/shiboken6/cmake/ShibokenSetup.cmake
@@ -19,7 +19,7 @@ shiboken_internal_set_up_extra_dependency_paths()
set(QT_MAJOR_VERSION 6)
message(STATUS "Using Qt ${QT_MAJOR_VERSION}")
-find_package(Qt${QT_MAJOR_VERSION} 6.0 REQUIRED COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
if(QUIET_BUILD)
set_quiet_build()
diff --git a/sources/shiboken6/generator/CMakeLists.txt b/sources/shiboken6/generator/CMakeLists.txt
index bac998ae5..7706c2b36 100644
--- a/sources/shiboken6/generator/CMakeLists.txt
+++ b/sources/shiboken6/generator/CMakeLists.txt
@@ -32,7 +32,7 @@ target_include_directories(shiboken6 PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${apiextractor_SOURCE_DIR}
)
-target_link_libraries(shiboken6 apiextractor Qt${QT_MAJOR_VERSION}::Core)
+target_link_libraries(shiboken6 apiextractor Qt::Core)
if (NOT DISABLE_DOCSTRINGS)
target_sources(shiboken6 PRIVATE qtdoc/qtxmltosphinx.cpp qtdoc/qtdocgenerator.cpp)
target_compile_definitions(shiboken6 PUBLIC DOCSTRINGS_ENABLED QT_LEAN_HEADERS=1)
diff --git a/sources/shiboken6/tests/dumpcodemodel/CMakeLists.txt b/sources/shiboken6/tests/dumpcodemodel/CMakeLists.txt
index 44652e7e5..3568b228d 100644
--- a/sources/shiboken6/tests/dumpcodemodel/CMakeLists.txt
+++ b/sources/shiboken6/tests/dumpcodemodel/CMakeLists.txt
@@ -9,5 +9,5 @@ target_include_directories(dumpcodemodel
target_link_libraries(dumpcodemodel
PRIVATE
apiextractor
- Qt${QT_MAJOR_VERSION}::Core
+ Qt::Core
)