From fecd9d90daa22b33c40a709da21cef62bfa44a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Wed, 5 Jun 2019 10:08:44 +0200 Subject: Fix static usage requirements for XcbQpa In particular, Qt targets extended with other qt targets (eg. Qt::VulkanSupport or Qt::LinuxAccessibilitySupport) after the first add_qt_module were not taken into account when generating Depends files. Note that this patch updates the minimum required version to CMake 3.15 Change-Id: I747deedd4d59e385876bc1a834ef9bdb6078911b Reviewed-by: Alexandru Croitor --- cmake/FindATSPI2.cmake | 3 +++ cmake/FindGTK3.cmake | 4 ++++ cmake/FindTslib.cmake | 4 ++++ cmake/FindXKB_COMMON_X11.cmake | 7 +++++++ cmake/QtBuild.cmake | 35 ++++++++++++++++++------------- cmake/QtFeature.cmake | 2 +- cmake/QtModuleDependencies.cmake.in | 8 ++----- cmake/QtProperties.cmake | 42 ++++++++++++++++++++++++++++++++++++- 8 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 cmake/FindXKB_COMMON_X11.cmake (limited to 'cmake') diff --git a/cmake/FindATSPI2.cmake b/cmake/FindATSPI2.cmake index 4e1ade0d07..87e3838ee9 100644 --- a/cmake/FindATSPI2.cmake +++ b/cmake/FindATSPI2.cmake @@ -2,4 +2,7 @@ include(FindPkgConfig) if(NOT TARGET PkgConfig::ATSPI2) pkg_check_modules(ATSPI2 atspi-2 IMPORTED_TARGET) + if (NOT TARGET PkgConfig::ATSPI2) + set(ATSPI2_FOUND 0) + endif() endif() diff --git a/cmake/FindGTK3.cmake b/cmake/FindGTK3.cmake index f4476c167b..9423eb4b9b 100644 --- a/cmake/FindGTK3.cmake +++ b/cmake/FindGTK3.cmake @@ -1,3 +1,7 @@ include(FindPkgConfig) pkg_check_modules(GTK3 "gtk+-3.0 >= 3.6" IMPORTED_TARGET) + +if (NOT TARGET PkgConfig::GTK3) + set(GTK3_FOUND 0) +endif() diff --git a/cmake/FindTslib.cmake b/cmake/FindTslib.cmake index 979291a5f6..3c50116d0a 100644 --- a/cmake/FindTslib.cmake +++ b/cmake/FindTslib.cmake @@ -1,3 +1,7 @@ find_package(PkgConfig) pkg_check_modules(Tslib tslib IMPORTED_TARGET) + +if (NOT TARGET PkgConfig::Tslib) + set(Tslib_FOUND 0) +endif() diff --git a/cmake/FindXKB_COMMON_X11.cmake b/cmake/FindXKB_COMMON_X11.cmake new file mode 100644 index 0000000000..61b4ba82e7 --- /dev/null +++ b/cmake/FindXKB_COMMON_X11.cmake @@ -0,0 +1,7 @@ +include(FindPkgConfig) + +pkg_check_modules(XKB_COMMON_X11 "xkbcommon-x11>=0.4.1" IMPORTED_TARGET) + +if (NOT TARGET PkgConfig::XKB_COMMON_X11) + set(XKB_COMMON_X11_FOUND 0) +endif() diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index bd18d48beb..85ee030822 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -795,7 +795,6 @@ function(extend_target target) endif() endif() endforeach() - # Set-up the target target_sources("${target}" PRIVATE ${arg_SOURCES} ${dbus_sources}) if (arg_COMPILE_FLAGS) @@ -811,6 +810,23 @@ function(extend_target target) AUTOMOC_MOC_OPTIONS "${arg_MOC_OPTIONS}" _qt_target_deps "${target_deps}" ) + + # When a public module depends on private, also make its private depend on the other's private + set(qt_libs_private "") + foreach(it ${QT_KNOWN_MODULES}) + list(FIND arg_LIBRARIES "Qt::${it}Private" pos) + if(pos GREATER -1) + list(APPEND qt_libs_private "Qt::${it}Private") + endif() + endforeach() + + set(target_private "${target}Private") + if(TARGET "${target_private}") + target_link_libraries("${target_private}" INTERFACE "${target}" "${qt_libs_private}") + endif() + qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}") + + qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS} DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}) @@ -1045,7 +1061,8 @@ function(add_qt_module target) ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}" VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} - OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}${target}") + OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}${target}" + ) qt_internal_library_deprecation_level(deprecation_define) @@ -1220,16 +1237,6 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})") # that belong to Qt. qt_internal_add_link_flags_no_undefined("${target}") - # When a public module depends on private, also make its private depend on the other's private - set(qt_libs_private "") - foreach(it ${QT_KNOWN_MODULES}) - list(FIND arg_LIBRARIES "Qt::${it}Private" pos) - if(pos GREATER -1) - list(APPEND qt_libs_private "Qt::${it}Private") - endif() - endforeach() - - target_link_libraries("${target_private}" INTERFACE "${target}" "${qt_libs_private}") target_include_directories("${target_private}" INTERFACE $ $ @@ -1238,8 +1245,6 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})") $ ) - qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}") - if(NOT ${arg_DISABLE_TOOLS_EXPORT}) qt_export_tools(${target}) endif() @@ -1399,6 +1404,8 @@ function(add_qt_plugin target) set_property(TARGET "${qt_module}" APPEND PROPERTY QT_PLUGINS "${target}") endif() + set_property(TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES "QT_PLUGIN_CLASS_NAME;QT_MODULE") + extend_target("${target}" SOURCES ${arg_SOURCES} INCLUDE_DIRECTORIES diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index c7e4764751..758605c05a 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -417,7 +417,7 @@ function(qt_feature_module_end) set(propertyPrefix "INTERFACE_") else() set(propertyPrefix "") - set_target_properties("${target}" PROPERTIES EXPORT_PROPERTIES "QT_ENABLED_PUBLIC_FEATURES;QT_DISABLED_PUBLIC_FEATURES;QT_ENABLED_PRIVATE_FEATURES;QT_DISABLED_PRIVATE_FEATURES") + set_target_properties("${target}" PROPERTIES EXPORT_PROPERTIES "QT_ENABLED_PUBLIC_FEATURES;QT_DISABLED_PUBLIC_FEATURES;QT_ENABLED_PRIVATE_FEATURES;QT_DISABLED_PRIVATE_FEATURES;MODULE_PLUGIN_TYPES;QT_PLUGINS") endif() foreach(visibility public private) string(TOUPPER "${visibility}" capitalVisibility) diff --git a/cmake/QtModuleDependencies.cmake.in b/cmake/QtModuleDependencies.cmake.in index f94ba22d9e..5d9164bd11 100644 --- a/cmake/QtModuleDependencies.cmake.in +++ b/cmake/QtModuleDependencies.cmake.in @@ -21,9 +21,7 @@ foreach(_target_dep ${_third_party_deps}) list(APPEND find_package_args "COMPONENTS" ${components}) endif() - if (NOT ${pkg}_FOUND) - find_dependency(${find_package_args}) - endif() + find_dependency(${find_package_args}) if (NOT ${pkg}_FOUND) set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE) @@ -40,9 +38,7 @@ foreach(_target_dep ${_tool_deps}) list(GET _target_dep 0 pkg) list(GET _target_dep 1 version) - if (NOT ${pkg}_FOUND) - find_dependency(${pkg} ${version}) - endif() + find_dependency(${pkg} ${version}) if (NOT ${pkg}_FOUND) set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE) diff --git a/cmake/QtProperties.cmake b/cmake/QtProperties.cmake index f2bb2c5c59..b0621e7b46 100644 --- a/cmake/QtProperties.cmake +++ b/cmake/QtProperties.cmake @@ -1,8 +1,48 @@ +define_property(TARGET + PROPERTY + QT_PLUGINS + BRIEF_DOCS + "List of Qt plug-ins associated with a given Qt module." + FULL_DOCS + "This is a property on Qt modules. + For instance, sqlite;odbc for Sql" +) + +define_property(TARGET + PROPERTY + MODULE_PLUGIN_TYPES + BRIEF_DOCS + "List of plugin categories associated to the Qt module" + FULL_DOCS + "This is a property on Qt modules. + For instance, sqldrivers for Sql." +) + define_property(TARGET PROPERTY QT_PLUGIN_CLASS_NAME BRIEF_DOCS "Class name of the Qt plug-in" FULL_DOCS - "For instance, QICOPlugin for the qico plug-in" + "This is a property on Qt plug-ins. + For instance, QICOPlugin for the qico plug-in" +) + +define_property(TARGET + PROPERTY + QT_MODULE + BRIEF_DOCS + "Qt module associated with a plug-in." + FULL_DOCS + "This is a property on Qt plug-ins. + For instance, Sql for qsqlite" +) + +define_property(GLOBAL + PROPERTY + QT_KNOWN_PLUGINS + BRIEF_DOCS + "" + FULL_DOCS + "" ) -- cgit v1.2.3