summaryrefslogtreecommitdiffstats
path: root/cmake/QtPostProcess.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-06 17:06:45 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-10 02:16:00 +0100
commitb04d087bd02f094874726629773a12ed3c1bff5e (patch)
treeaafbf493faee7aeb9a0b847b4ff86314c58156c1 /cmake/QtPostProcess.cmake
parentd71545e115f4aad125042639d8276f0e1a0fe113 (diff)
CMake: Handle path components like INSTALL_LIBDIR more correctly
We recomputed INSTALL_LIBDIR for every new repo that is configured, which is incorrect due losing any custom provided libdir when configuring qtbase. Save that information (and all other path components) in QtBuildInternalsConfigExtra.cmake. Make sure not to-recompute that information when configuring a project other than QtBase. Allow providing absolute paths instead of relative paths for these variables. Note that only absolute paths pointing somewhere under the prefix will currently work, otherwise configuraion will fail. If we need to support such a use case, we'll have to carefully check all code that use these path components to make sure they handle absolute paths correctly (current assumption is relative paths everywhere). Use the computed paths when generating the qconfig.cpp file which is used for qmake -query. Task-number: QTBUG-81289 Change-Id: I331aa00e47988fe0ee4e533b5f95c4df11c4d96f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtPostProcess.cmake')
-rw-r--r--cmake/QtPostProcess.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake
index c4c4510c65..531feb0ca0 100644
--- a/cmake/QtPostProcess.cmake
+++ b/cmake/QtPostProcess.cmake
@@ -307,6 +307,21 @@ function(qt_internal_create_plugins_files)
endforeach()
endfunction()
+function(qt_generate_install_prefixes out_var)
+ set(content "\n")
+ set(vars INSTALL_BINDIR INSTALL_INCLUDEDIR INSTALL_LIBDIR INSTALL_MKSPECSDIR INSTALL_ARCHDATADIR
+ INSTALL_PLUGINSDIR INSTALL_LIBEXECDIR INSTALL_QMLDIR INSTALL_DATADIR INSTALL_DOCDIR
+ INSTALL_TRANSLATIONSDIR INSTALL_SYSCONFDIR INSTALL_EXAMPLESDIR INSTALL_TESTSDIR
+ INSTALL_DESCRIPTIONSDIR)
+
+ foreach(var ${vars})
+ get_property(docstring CACHE "${var}" PROPERTY HELPSTRING)
+ string(APPEND content "set(${var} \"${${var}}\" CACHE STRING \"${docstring}\" FORCE)\n")
+ endforeach()
+
+ set(${out_var} "${content}" PARENT_SCOPE)
+endfunction()
+
function(qt_generate_build_internals_extra_cmake_code)
if(PROJECT_NAME STREQUAL "QtBase")
foreach(var IN LISTS QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT)
@@ -347,6 +362,10 @@ function(qt_generate_build_internals_extra_cmake_code)
"set(CMAKE_DEFAULT_BUILD_TYPE \"${CMAKE_DEFAULT_BUILD_TYPE}\" CACHE STRING \"\")\n")
endif()
+ qt_generate_install_prefixes(install_prefix_content)
+
+ string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "${install_prefix_content}")
+
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/QtBuildInternalsExtra.cmake.in"
"${extra_file_path}"