aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2021-02-09 21:28:08 +0000
committerDaan De Meyer <daan.j.demeyer@gmail.com>2021-02-09 21:28:08 +0000
commitfe91d86bf612ed0a9c1fc6cb049d123f4a416312 (patch)
treedf57c46655d7eec7f12c6640ec33263d70512551
parentcd2f66b9aa12455b914952c5c61518490d0c172d (diff)
downloadextra-cmake-modules-fe91d86bf612ed0a9c1fc6cb049d123f4a416312.tar.gz
extra-cmake-modules-fe91d86bf612ed0a9c1fc6cb049d123f4a416312.tar.bz2
Fix relative path edge case in ECMGeneratePriFile
When the qt install prefix and the qt host data path are the same, CMake's RELATIVE_PATH file path function will return the empty string. This made us accidentally set ECM_MKSPECS_INSTALL_DIR to /mkspecs/modules. Fix this by explicitly checking for the empty string. Once we can depend on CMake 3.20, we can use CMake's builtin function for joining paths instead.
-rw-r--r--modules/ECMGeneratePriFile.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/ECMGeneratePriFile.cmake b/modules/ECMGeneratePriFile.cmake
index 22c88183..0f6cd905 100644
--- a/modules/ECMGeneratePriFile.cmake
+++ b/modules/ECMGeneratePriFile.cmake
@@ -89,12 +89,17 @@ endif()
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _askqmake)
include(ECMQueryQmake)
- query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX TRY)
+ query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX)
query_qmake(qt_host_data_dir QT_HOST_DATA)
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH qt_host_data_dir ${qt_install_prefix_dir} ${qt_host_data_dir})
endif()
- set(ECM_MKSPECS_INSTALL_DIR ${qt_host_data_dir}/mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
+ if(qt_host_data_dir STREQUAL "")
+ set(mkspecs_install_dir mkspecs/modules)
+ else()
+ set(mkspecs_install_dir ${qt_host_data_dir}/mkspecs/modules)
+ endif()
+ set(ECM_MKSPECS_INSTALL_DIR ${mkspecs_install_dir} CACHE PATH "The directory where mkspecs will be installed to.")
else()
set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
endif()