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

CMake: fix linking on macOS #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

wolfgangw
Copy link

@wolfgangw wolfgangw commented Dec 25, 2023

Specifying cmake_minimum_required(VERSION 2.8.12) triggers cmake to fall-back to old behaviour wrt @rpath on my recent macOS system - which in turn breaks linking. Build succeeds, but the binaries die with dyld's Library not loaded error.

https://cmake.org/cmake/help/latest/policy/CMP0042.html has a comment on cmake's changed default wrt MACOSX_RPATH in versions >= 3.0.

cmake_minimum_required(VERSION 3.0) fixes the linking for me.

If changing cmake_minimum_required breaks stuff for people there is another option:
Instead add set(CMAKE_MACOSX_RPATH ON) early in CMakeLists.txt.

My cmake version from a fresh brew install cmake is 3.28.1. make from xcode-select --install is 3.81. macOS is 14.2.1.

Superficial understanding of the involved mechanisms, so this may well be a local issue.

@wolfgangw wolfgangw changed the title Fix linking on MacOS CMake: fix linking on MacOS Dec 30, 2023
@wolfgangw wolfgangw changed the title CMake: fix linking on MacOS CMake: fix linking on macOS Dec 30, 2023
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

Successfully merging this pull request may close these issues.

1 participant