-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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: setup-hook.sh: add genCmakeDefaultFlags() #335682
base: staging
Are you sure you want to change the base?
Conversation
52ec97d
to
f118c78
Compare
@ofborg build cmake |
f118c78
to
adeb434
Compare
@ofborg build cmakeMinimal |
adeb434
to
1f1e1d3
Compare
Format with `shfmt -i 4 -w pkgs/by-name/cm/cmake/setup-hook.sh`. Keeping the code auto-formatted makes refactoring easier.
1f1e1d3
to
a097601
Compare
I adjusted the style and changed the order to group all the non-conditional flags. @wolfgangwalther, what do you think about the current style? |
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.
The first two commits LGTM. We'll need to assume that the order of flags for cmake doesn't matter, though.
The last commit says:
This enables developers to get the default CMake flags provided by Nixpkgs without having to use cmakeConfigurePhase.
I don't understand the reason for that last commit, yet. Why is that important, what would you do with those flags?
In a build flow where other build tools control CMake, the package developer needs to configure the command-line arguments for CMake without executing CMake itself. A Bash function to provide the flags without running the whole Update: Such use cases are essentially edge cases. I shouldn't emphasize them too much. |
Collect the default CMake configure flags collected by cmakeConfigurePhase into a Bash array named cmakeDefaultFlags.
a097601
to
dd0682d
Compare
Extract the code constructing the cmakeDefaultFlags into a Bash function genCmakeDefaultFlags.
dd0682d
to
a3cfdba
Compare
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.
First two commits LGTM. Only eye-balled the changes, did not build anything with it.
Last commit I can't say much about the usefulness, but it shouldn't do any harm.
Would it sound more clearly if the function is called |
Description of changes
This PR extracts the default CMake flags pretending code into its own Bash function
genCmakeDefaultFlags()
. Instead of pretending the flags tocmakeFlags
, it collects them into a global Bash arraycmakeDefaultFlags
.Original discussions:
#318614 (comment)
#299622 (comment)
Cc: @AndersonTorres @jtojnar @wolfgangwalther
Things done
cmakeMinimal
)nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.