summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/create_cmake.prf
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2013-04-17 14:55:36 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-19 12:03:36 +0200
commit5aa349628e2d4913e5aeddd6557d578f34e31fc0 (patch)
tree0f6eb6c82593d33df489d9a48371b871392d8f39 /mkspecs/features/create_cmake.prf
parent5ea3845bd0bf4dec9828270ab18e7c94d596975e (diff)
Handle usr-move without forcing absolute paths
In qtbase commit 7ac58d1ff0815566ba1de09519299b5119e5ee91 (Make cmake packages installed to /usr non-relocatable., 2013-02-11), we made cmake config files non-relocatable if they were installed to the /usr prefix. That was assumed to mean that this was a distro or platform package, and was a workaround for the usr-move problem on Fedora and ArchLinux. However, cmake bug http://public.kitware.com/Bug/view.php?id=14041 showed that forcing absolute paths in this situation is not desirable in cross compiling scenarios. CMake commit 6c613b433c45efb0bb013a6bd668cbb8ac740259 (Handle usr-move without forcing absolute paths (#14041), 2013-04-03) addressed the problem in CMake, and this commit is an equivalent. Change-Id: I065a6230bc618aa980fae6ca511ae10df4cd62c2 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'mkspecs/features/create_cmake.prf')
-rw-r--r--mkspecs/features/create_cmake.prf19
1 files changed, 11 insertions, 8 deletions
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index cf0acaf4b7..a9757acd17 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -27,19 +27,22 @@ CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::")
# The /lib paths are made symlinks to the /usr/lib paths. If someone searching
# for a Qt 5 package finds it in /lib/cmake/Qt5Core, although it has been
# installed in /usr/lib/cmake/Qt5Core, relative paths to the includes and
-# executables will not work. So, we treat installations to /usr as non-relocatable
-# packages with absolute paths.
-CMAKE_INSTALL_LIBS_DIR = $$[QT_INSTALL_LIBS]
-contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_FORCE_ABSOLUTE_PATHS = True
+# executables will not work.
+# To work around this, we insert code into the generated config files to check
+# at cmake time whether package has been found via a symlink, and correct
+# that to an absolute path. This is only done for installations to
+# the /usr or / prefix.
+CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
+contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
-!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
+contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
}
CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
-!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
CMAKE_LIB_DIR_IS_ABSOLUTE = True
} else {
@@ -50,13 +53,13 @@ CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
}
CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
-!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
CMAKE_BIN_DIR_IS_ABSOLUTE = True
}
CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA], $$[QT_INSTALL_PREFIX])
-!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*") {
+contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*") {
CMAKE_HOST_DATA_DIR = $$[QT_HOST_DATA]/
CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = True
}