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: use multiple outputs for GNUInstallDirs #52859
Conversation
CMake contains a module for more granular installation directories: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html Let’s set the paths so that projects using the module can be more easily split into multiple outputs.
Thank you! This looks good, except that This will generate even more warnings like the following for projects that do not use GNUInstallDirs:
This can be avoided by writing a file with
and running |
I followed the directories in
As for the warning, I think it might be useful to retain it. If we want to do something about it, I would prefer patching CMake to show a single warning, something like “Manually-specified variables CMAKE_INSTALL_* flags are commonly registered by GNUInstallDirs module but the project does not include it.” and try to push it upstream. |
I guess so, since libexec is for binaries which are likely to depend on libraries, while libraries may not depend on the binaries; but @vcunat has moved libexec from bin to lib in 3ec413c seemingly intentionally.
Why? So far it has been only distracting. With more variables we will turn blind to it. |
I think udisks is an example of a library that depends on a daemon from
It can serve as a reminder to pester upstream about it. |
OK, perhaps
These warnings can hardly serve that purpose: before this discussion I had no idea that |
I have looked at
The first is because it is a C++-only project. |
Such warnings make it difficult to notice cmake flags in specific |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! It looks like CMake is getting quite a lot of flags though. Would it make sense to put these in pkgs/build-support/setup-hooks/multiple-outputs.sh instead? It's a little bit confusing where the right place to include these kinds of things is & okay to leave here for now.
I mainly chose to put it here as meson does the same in its own setup hook. Also, with more and more build systems, multiple-outputs would explode. |
Yeah that makes sense. Perhaps we should make these conditional on |
That's an interesting idea! For the purpose of preventing breakage of packages that expect these variables to contain relative paths, it might be even better to individually compare them to
For the purpose of preventing useless CMake warnings, it is better to save them to a CMake cache file rather than to pass them on the command line. |
Breakage in zoneminder: #76855 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/could-weve-implemented-multi-output-packages-better/6597/2 |
If you find this pull request and think this broke your package, please fix the project upstream as described in https://github.com/jtojnar/cmake-snips#assuming-cmake_install_dir-is-relative-path |
Motivation for this change
CMake contains a module for more granular installation directories. Let’s set the paths so that projects using the module (e.g. #52856) can be more easily split into multiple outputs.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)