Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to turn off CMAKE_SKIP_RPATH or make it target specific #49

Open
Silentd00m opened this issue Oct 4, 2022 · 1 comment

Comments

@Silentd00m
Copy link

Silentd00m commented Oct 4, 2022

Currently projects using CPM that use this library will have their RPATH broken for all targets defined after the CPMAddPackage for physfs, unless CMAKE_SKIP_RPATH is force-set to OFF.

Example:

CPMAddPackage(
  NAME physfs
  GIT_REPOSITORY https://github.com/icculus/physfs
  GIT_TAG release-3.2.0
  OPTIONS "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}"
                  "PHYSFS_ARCHIVE_GRP OFF"
		  "PHYSFS_ARCHIVE_WAD OFF"
		  "PHYSFS_ARCHIVE_HOG OFF"
		  "PHYSFS_ARCHIVE_MVL OFF"
		  "PHYSFS_ARCHIVE_QPAK OFF"
		  "PHYSFS_ARCHIVE_SLB OFF"
		  "PHYSFS_ARCHIVE_ISO9660 OFF"
		  "PHYSFS_ARCHIVE_VDF OFF")

# Cleanup after physfs' use of set to avoid breaking the linker.
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
  set(CMAKE_SKIP_RPATH OFF CACHE BOOL "Skip RPATH" FORCE)
endif()

Having an option to turn this behaviour off would be appreciated.

I can provide a small pull request that implements this, if this feature is accepted.

@madebr
Copy link
Contributor

madebr commented Feb 23, 2024

set(CMAKE_SKIP_RPATH OFF CACHE BOOL "Skip RPATH" FORCE) has already been removed from the 4.0 branch.
I think it can also be removed from the 3.2 branch.

I noticed Ryan adds/added these to lots of his projects, probably because the build-time rpath should not be present in installed libraries.
When doing cmake --install $buildfolder, by default, CMake will remove the runpath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants