diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-03-24 22:58:14 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-03-25 11:16:48 +0100 |
commit | c269d8f0862fd2c581d57584e8d7e2493f387ee7 (patch) | |
tree | 962902fecfcc4c62fed7a4029a476f1fd8fa3924 /cmake/QtBuild.cmake | |
parent | f716a8735285d3919164a0faadc542a866465d3d (diff) |
CMake: Fix the re-computed value of INSTALL_*DIR variables
For INSTALL_*DIR variables that have the the same value as
CMAKE_INSTALL_PREFIX, a second cmake run cleared the value. This is
because file(RELATIVE_PATH) returns the empty string if we pass the same
absolute paths.
Fix this by checking the return value of file(RELATIVE_PATH) for the
empty string and setting it to ".".
It's a limitation of qmake that empty strings are not handled as ".".
Change-Id: I8fc4d1eabcc9d5634be2f3741b0002a347dd17e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 43ee166ce9..84a4db70d5 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -21,7 +21,10 @@ function(qt_configure_process_path name default docstring) # If relative path given, it's relative to the install prefix (rather than the binary dir, # which is what qmake does for some reason). # In both cases, store the value as a relative path. - if(rel_path MATCHES "^\.\./") + if("${rel_path}" STREQUAL "") + # 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} ") endif() |