diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-16 11:34:06 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-17 11:10:44 +0000 |
commit | 140b65e36f71189fee181330018ed9fe8479fc6b (patch) | |
tree | e16fc49e05b0d25501957f74fc60aba06e83fea2 /cmake | |
parent | 85b038a0a23625bd45ff7b39f9db83d274bb33d5 (diff) |
Propagate QT_CMAKE_EXPORT_NAMESPACE via QtCore package
QT_CMAKE_EXPORT_NAMESPACE is used by the Qt packages to make features
available to the consuming CMake project. The value was moved to the
BuildInternals Config file, but that's wrong because consuming
applications not including the BuildInternals component would fail
to use any other Qt package.
Move QT_CMAKE_EXPORT_NAMESPACE to be propagated with QtCore package
again.
Amends 9542e78525b422159406d8fa63e30dcd0f926411.
Change-Id: I9841ac8c2828b00c0111d59e8976c889554e0ce1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 10 | ||||
-rw-r--r-- | cmake/QtModuleConfig.cmake.in | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index cc5b9e63e1..50722a5475 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -930,6 +930,16 @@ function(add_qt_module target) list(APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake") endif() + set(extra_cmake_code "") + + if(target STREQUAL Core) + # Propagate non-build related variables that are needed for consuming Qt packages. + # Do this in CoreConfig instead of Qt5Config, so that consumers can also use + # find_package(Qt5Core) instead of find_package(Qt5 COMPONENTS Core) + string(APPEND extra_cmake_code " +set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})") + endif() + configure_package_config_file( "${QT_CMAKE_DIR}/QtModuleConfig.cmake.in" "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake" diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in index 7baea8cf9c..6a68fdf3b0 100644 --- a/cmake/QtModuleConfig.cmake.in +++ b/cmake/QtModuleConfig.cmake.in @@ -5,6 +5,10 @@ include(CMakeFindDependencyMacro) get_filename_component(_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(_import_prefix "${_import_prefix}" REALPATH) +# Extra cmake code begin +@extra_cmake_code@ +# Extra cmake code end + # Find required dependencies, if any. if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake") include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake") |