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 <robert.loehning@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Tobias Hunger
2019-06-05 14:48:37 +02:00
parent 772b48797d
commit 27dee4dc5c

View File

@@ -1,6 +1,9 @@
if (IDE_LIBEXEC_PATH AND IDE_BIN_PATH) if (IDE_LIBEXEC_PATH AND IDE_BIN_PATH)
file(RELATIVE_PATH RELATIVE_TOOLS_PATH get_filename_component(bin_path
"${CMAKE_INSTALL_PREFIX}/${IDE_BIN_PATH}" "${CMAKE_INSTALL_PREFIX}/${IDE_LIBEXEC_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() else()
message(WARNING "IDE_LIBEXEC_PATH or IDE_BIN_PATH undefined when calculating tools path") message(WARNING "IDE_LIBEXEC_PATH or IDE_BIN_PATH undefined when calculating tools path")
set(RELATIVE_TOOLS_PATH "") set(RELATIVE_TOOLS_PATH "")