Use rpath by default not only for building but also installed binaries
This makes it possible to use the binaries out of the box. This is particularly relevant for program binaries that link against QtCore dynamically, when trying to use these binaries during cross-compilation. Change-Id: I7dee93194be3fff5c6e3bbb9e202e4cf5e19b6d0 Reviewed-by: Volker Krause <volker.krause@kdab.com>
This commit is contained in:
parent
d523a642dc
commit
96c0dc07a7
@ -40,6 +40,20 @@ set(INSTALL_CMAKE_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}" CACHE STRING "CMake nam
|
|||||||
|
|
||||||
set(QT_CMAKE_EXPORT_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}" CACHE STRING "CMake namespace used when exporting targets [Qt${PROJECT_VERSION_MAJOR}]")
|
set(QT_CMAKE_EXPORT_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}" CACHE STRING "CMake namespace used when exporting targets [Qt${PROJECT_VERSION_MAJOR}]")
|
||||||
|
|
||||||
|
# the default RPATH to be used when installing, but only if it's not a system directory
|
||||||
|
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
|
||||||
|
IF("${isSystemDir}" STREQUAL "-1")
|
||||||
|
SET(_default_install_rpath "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
ENDIF("${isSystemDir}" STREQUAL "-1")
|
||||||
|
|
||||||
|
# Default rpath settings: Use rpath for build tree as well as a full path for the installed binaries.
|
||||||
|
# For origin builds, one needs to override CMAKE_INSTALL_RPATH for example with $ORIGIN/../lib
|
||||||
|
SET(CMAKE_INSTALL_RPATH "${_default_install_rpath}" CACHE PATH "RPATH for installed binaries")
|
||||||
|
|
||||||
|
# add the automatically determined parts of the RPATH
|
||||||
|
# which point to directories outside the build tree to the install RPATH
|
||||||
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
# Platform define path, etc.
|
# Platform define path, etc.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(QT_DEFAULT_PLATFORM_DEFINITIONS UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
|
set(QT_DEFAULT_PLATFORM_DEFINITIONS UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user