CMakePP / CMaize

Simplifies writing CMake-based build systems.
https://cmakepp.github.io/CMaize
Apache License 2.0
11 stars 11 forks source link

[BUG] RPATH not set correctly for Mac OSX #97

Open zachcran opened 1 year ago

zachcran commented 1 year ago

Describe the bug The current implementation in CMaize for setting the RPATH on targets only supports Linux RPATH settings. Apple has a similar feature, but different keywords.

To Reproduce Must be on a Mac

  1. Set up a vanilla CMake repository, or a CMaize repository, called repo_1.
  2. Make another CMaize repository that depends on the first one, called repo_2, with a test called test_repo_2. This test should not directly depend on repo_1.
  3. Build and install repo_1 and add the install path to your CMAKE_PREFIX_PATH.
  4. Build repo_2 and test_repo_2.
  5. Try to run the test_repo_2 test.
  6. See an error about the repo_1 dylib not being found.

Expected behavior The RPATH of generated libraries and executables should be set properly to find dependencies after the CMake build.

Additional context The best practice appears to be to special-case Apple build RPATH settings. Craig Scott has a great talk about CMake installs and RPATHs from CppCon 2019 that helps explain where to start, but does not go into details about how to handle Apple systems. (Timestamp at 50:26: https://youtu.be/m0DwB4OvDXk?t=3026)

ryanmrichard commented 11 months ago

@zachcran was this addressed by your recent rpath changes?

zachcran commented 11 months ago

@ryanmrichard In theory, yes, but I haven't tested it on a Mac yet.

zachcran commented 11 months ago

@ryanmrichard In theory, yes, but I haven't tested it on a Mac yet.

Actually, scratch that. I apparently did test it on Mac (see #133 checklist).