soci icon indicating copy to clipboard operation
soci copied to clipboard

CMake: Please remove hardcoded INSTALL_NAME_DIR

Open SpaceIm opened this issue 4 years ago • 5 comments

Could you revert https://github.com/SOCI/soci/pull/30 please? INSTALL_NAME_DIR shouldn't be hardcoded, it prevents to create relocatable shared libs on macOS (@rpath as INSTALL_NAME_DIR, which is the default behavior of CMake since 3.0), and more generally to customize this value externally.

SpaceIm avatar Jan 30 '22 22:01 SpaceIm

Sorry, I'm not fluent in CMake, so I'm not sure what needs to be done here. I suspect just reverting this wouldn't be the right thing to do, as we probably still want to do it for the non-Mac platforms?

vadz avatar Jan 31 '22 12:01 vadz

INSTALL_NAME_DIR is irrelevant on non-Mac platforms: https://cmake.org/cmake/help/latest/prop_tgt/INSTALL_NAME_DIR.html

And the default behavior of CMake is to make shared libs on macOS rpath friendly (which means relocatables) like you have for free on other *nix platforms: https://cmake.org/cmake/help/latest/prop_tgt/MACOSX_RPATH.html

When this property is set to TRUE, the directory portion of the install_name field of this shared library will be @rpath unless overridden by INSTALL_NAME_DIR. This indicates the shared library is to be found at runtime using runtime paths (rpaths).

SpaceIm avatar Jan 31 '22 12:01 SpaceIm

@vadz I think this can probably be closed

Krzmbrzl avatar Dec 29 '23 16:12 Krzmbrzl

Sorry, why? I.e. I'd be glad to close it, but it would be nice to at least have some explanation for doing it...

vadz avatar Dec 29 '23 17:12 vadz

Oops. I only saw the linked, merged PR and figured this was the fix. Looking at the PR now though, this is wrong. Sorry for the ping :see_no_evil:

Krzmbrzl avatar Dec 29 '23 20:12 Krzmbrzl