From 4a0a466b7565407d31e3932ca03fac25e4fd6ea3 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 8 Dec 2020 16:26:57 +0100 Subject: [PATCH] cmake build: Fix sdktool default output path The relative path that is passed to the sdktool build must be relative from the sdktool binary to the data path. IDE_DATA_PATH is relative from the Qt Creator binary. Change-Id: If74d9a07cb491247861eef36ebf8406de4fdedd8 Reviewed-by: Cristian Adam --- src/tools/sdktool/CMakeLists.txt | 4 +++- src/tools/sdktool/main.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tools/sdktool/CMakeLists.txt b/src/tools/sdktool/CMakeLists.txt index cdd9d50f147..76040f4ba00 100644 --- a/src/tools/sdktool/CMakeLists.txt +++ b/src/tools/sdktool/CMakeLists.txt @@ -40,9 +40,11 @@ endif() set(UtilsSourcesDir "../../libs/utils") +file(RELATIVE_PATH DATA_PATH "/${IDE_LIBEXEC_PATH}" "/${IDE_DATA_PATH}") + add_qtc_executable(sdktool ${DESTINATION} - DEFINES DATA_PATH=\"${IDE_DATA_PATH}\" + DEFINES DATA_PATH=\"${DATA_PATH}\" DEPENDS Qt5::Core INCLUDES "${UtilsSourcesDir}/../" diff --git a/src/tools/sdktool/main.cpp b/src/tools/sdktool/main.cpp index c1ecb287461..0a07b1157cf 100644 --- a/src/tools/sdktool/main.cpp +++ b/src/tools/sdktool/main.cpp @@ -79,6 +79,14 @@ void printHelp(const std::vector> &operations) std::cout << " --help|-h Print this help text" << std::endl; std::cout << " --sdkpath=PATH|-s PATH Set the path to the SDK files" << std::endl << std::endl; + std::cout << "Default sdkpath is \"" + << qPrintable(QDir::cleanPath( + Utils::FilePath::fromString(QCoreApplication::applicationDirPath()) + .pathAppended(DATA_PATH) + .toUserOutput())) + << "\"" << std::endl + << std::endl; + std::cout << "OPERATION:" << std::endl; std::cout << " One of:" << std::endl; for (const std::unique_ptr &o : operations)