From fe91d86bf612ed0a9c1fc6cb049d123f4a416312 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 9 Feb 2021 21:28:08 +0000 Subject: 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. --- modules/ECMGeneratePriFile.cmake | 9 +++++++-- 1 file 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() -- cgit v1.2.1