Skip to content

Commit

Permalink
[cmake] Clean up rpath settings
Browse files Browse the repository at this point in the history
Only build with install path if RELOCATABLE is on, otherwise we can stick to
the default build rpath.

We were setting these options to their default values:
CMAKE_MACOS_RPATH, CMAKE_SKIP_BUILD_RPATH, CMAKE_SKIP_INSTALL_RPATH
  • Loading branch information
tobil4sk committed May 9, 2024
1 parent 53c000f commit 5dd4dbe
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,11 @@ endforeach()

include(ExternalProject)


# CMAKE_BUILD_WITH_INSTALL_RPATH should be set to true.
# It is because `nekotools boot` will use the neko in build dir during build.
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

if (RELOCATABLE)
# https://cmake.org/Wiki/CMake_RPATH_handling
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
# Set this to true, otherwise the binaries won't be relocatable until after installation:
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_RPATH @executable_path/)
elseif(UNIX)
set(CMAKE_INSTALL_RPATH \$ORIGIN)
Expand Down

0 comments on commit 5dd4dbe

Please sign in to comment.