Skip to content

CMake: dont concatenate absolute GNUInstallDirs - #3601

Open
nim65s wants to merge 1 commit into
google-deepmind:mainfrom
nim65s:cmake-absolute
Open

nim65s wants to merge 1 commit into
google-deepmind:mainfrom
nim65s:cmake-absolute

Conversation

@nim65s

@nim65s nim65s commented Sep 16, 2026

Copy link
Copy Markdown

Hi,

Building mujoco in nixpkgs, I've just seen a bunch of red flags like [ 88%] Linking CXX shared library ../../nix/store/m96gkn3ack9i93xi0dqzm71g9baz3p9i-mujoco-3.13.0/lib/libsdf_plugin.so, where /nix/store is an absolute path.

In cmake, the GNUInstallDirs CMAKE_INSTALL_*DIR variables can be provided by the end user (or package manager), and therefore they can be absolute.

When that is the case, they should not be concatenated after any other path.

This pull request replace ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_*DIR}" uses by ${CMAKE_INSTALL_FULL_*DIR}, also provided by GNUInstallDirs, which is able to handle correctly the absolute case.

(A nice side-effect of this change is to also handle package relocations: when the user decide to move the package away from build-time CMAKE_INSTALL_PREFIX after installation, as this is for example always the case with the conda package manager)

In a similar way, "${CMAKE_INSTALL_*DIR}" are replaced by a a default bin / lib when absolute and concatenated to ${CMAKE_BINARY_DIR}.

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