summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-08-12 20:00:05 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-08-13 19:45:33 +0200
commit48dbcefe57860f70e9bc4859983d2596634ea8f3 (patch)
tree656a9e245612f55723ee75497fdab34da9ef36e3 /cmake
parent9e044765ec88ee32781278f44a25746744dd48ec (diff)
CMake: Allow specifying a sysconfdir that's outside the prefix
Also use the value to actually write it into qconfig.cpp so that qmake reports the right information. Change-Id: Icc4bf36b0dc6ad75d93ac16f39e5b361c0ce52b4 Fixes: QTBUG-81289 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake27
1 files changed, 17 insertions, 10 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 28bf5533d6..0ab5dc2ff4 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -26,10 +26,16 @@ function(qt_configure_process_path name default docstring)
# file(RELATIVE_PATH) returns an empty string if the given absolute paths are equal
set(rel_path ".")
elseif(rel_path MATCHES "^\.\./")
- message(FATAL_ERROR
- "Path component '${name}' is outside computed install prefix: ${rel_path} ")
+ # INSTALL_SYSCONFDIR is allowed to be outside the prefix.
+ if(NOT name STREQUAL "INSTALL_SYSCONFDIR")
+ message(FATAL_ERROR
+ "Path component '${name}' is outside computed install prefix: ${rel_path} ")
+ return()
+ endif()
+ set("${name}" "${${name}}" CACHE STRING "${docstring}" FORCE)
+ else()
+ set("${name}" "${rel_path}" CACHE STRING "${docstring}" FORCE)
endif()
- set("${name}" "${rel_path}" CACHE STRING "${docstring}" FORCE)
endif()
endfunction()
@@ -116,9 +122,14 @@ qt_configure_process_path(INSTALL_DATADIR "." "Arch-independent data [PREFIX]")
qt_configure_process_path(INSTALL_DOCDIR "${INSTALL_DATADIR}/doc" "Documentation [DATADIR/doc]")
qt_configure_process_path(INSTALL_TRANSLATIONSDIR "${INSTALL_DATADIR}/translations"
"Translations [DATADIR/translations]")
+if(APPLE)
+ set(QT_DEFAULT_SYS_CONF_DIR "/Library/Preferences/Qt")
+else()
+ set(QT_DEFAULT_SYS_CONF_DIR "etc/xdg")
+endif()
qt_configure_process_path(INSTALL_SYSCONFDIR
- "etc/xdg"
- "Settings used by Qt programs [PREFIX/etc/xdg]")
+ "${QT_DEFAULT_SYS_CONF_DIR}"
+ "Settings used by Qt programs [PREFIX/etc/xdg]/[/Library/Preferences/Qt]")
qt_configure_process_path(INSTALL_EXAMPLESDIR "examples" "Examples [PREFIX/examples]")
qt_configure_process_path(INSTALL_TESTSDIR "tests" "Tests [PREFIX/tests]")
qt_configure_process_path(INSTALL_DESCRIPTIONSDIR
@@ -5830,11 +5841,7 @@ function(qt_generate_qconfig_cpp)
set(QT_CONFIG_STRS_SECOND "${QT_CONFIG_STRS}")
# Settings path / sysconf dir.
- if(APPLE)
- set(QT_DEFAULT_SYS_CONF_DIR "/Library/Preferences/Qt")
- else()
- set(QT_DEFAULT_SYS_CONF_DIR "etc/xdg")
- endif()
+ set(QT_SYS_CONF_DIR "${INSTALL_SYSCONFDIR}")
# Compute and set relocation prefixes.
# TODO: Clean this up, there's a bunch of unrealistic assumptions here.