From 27dee4dc5c221ea9006514515acd3239efc36bf1 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 5 Jun 2019 14:48:37 +0200 Subject: [PATCH] CMake: Allow for relative install prefixes Allow for a CMAKE_INSTALL_PREFIX relative to the build directory. This is nice for testing installation. Change-Id: I00dd338618cfbcc061039cf13e50239b77db3585 Reviewed-by: Robert Loehning Reviewed-by: Cristian Adam --- src/libs/utils/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/CMakeLists.txt b/src/libs/utils/CMakeLists.txt index 00307728a68..0cbbeadfc17 100644 --- a/src/libs/utils/CMakeLists.txt +++ b/src/libs/utils/CMakeLists.txt @@ -1,6 +1,9 @@ if (IDE_LIBEXEC_PATH AND IDE_BIN_PATH) - file(RELATIVE_PATH RELATIVE_TOOLS_PATH - "${CMAKE_INSTALL_PREFIX}/${IDE_BIN_PATH}" "${CMAKE_INSTALL_PREFIX}/${IDE_LIBEXEC_PATH}") + get_filename_component(bin_path + "${CMAKE_INSTALL_PREFIX}/${IDE_BIN_PATH}" ABSOLUTE "${CMAKE_BINARY_DIR}") + get_filename_component(libexec_path + "${CMAKE_INSTALL_PREFIX}/${IDE_LIBEXEC_PATH}" ABSOLUTE "${CMAKE_BINARY_DIR}") + file(RELATIVE_PATH RELATIVE_TOOLS_PATH "${bin_path}" "${libexec_path}") else() message(WARNING "IDE_LIBEXEC_PATH or IDE_BIN_PATH undefined when calculating tools path") set(RELATIVE_TOOLS_PATH "")