From c269d8f0862fd2c581d57584e8d7e2493f387ee7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 24 Mar 2020 22:58:14 +0100 Subject: [PATCH] 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 --- cmake/QtBuild.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()