Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ if (USE_ONLY_EMBEDDED_RESOURCE_FILES AND NOT EMBED_RESOURCE_FILES)
message(WARNING "USE_ONLY_EMBEDDED_RESOURCE_FILES=ON set but EMBED_RESOURCE_FILES=OFF: some drivers will lack required resource files")
endif()

option(PROJ_SET_INSTALL_RELATIVE_RPATH "Whether to set rpath on installed libraries" OFF)

################################################################################
# Build configured components
################################################################################
Expand Down
4 changes: 4 additions & 0 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ All cached entries can be viewed using ``cmake -LAH`` from a build directory.
Path to an existing directory used to cache :file:`proj.db` to speed-up
subsequent builds without modifications to source SQL files.

.. option:: PROJ_SET_INSTALL_RELATIVE_RPATH=OFF

Whether to set relative rpath on installed libraries.

.. option:: TESTING_USE_NETWORK=ON

.. versionadded:: 9.5
Expand Down
8 changes: 8 additions & 0 deletions src/lib_proj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ add_library(proj
)
add_library(PROJ::proj ALIAS proj)

if (PROJ_SET_INSTALL_RELATIVE_RPATH)
if(APPLE)
set_target_properties(proj PROPERTIES INSTALL_RPATH "@loader_path")
elseif(UNIX)
set_target_properties(proj PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
endif()

if(MSVC OR MINGW)
target_compile_definitions(proj PRIVATE -DNOMINMAX)
endif()
Expand Down
Loading