-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[C][Client] Make custom CMAKE_C_FLAGS work #20432
Conversation
thanks for the PR moving forward, please copy the C technical committee: @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) @eafer (2024/12) |
Thanks, will do. |
The sample client defined in bin/configs/c.yaml has CMakeLists.txt in its .openapi-generator-ignore. It's is the only C client that doesn't (re-)generate CMakeLists.txt, the remaining two seem fine regardless.
find_package() prints success/failure messages, no need to do it twice.
cc99bb9
to
54d3a70
Compare
Rebased, and also added a minor CMakeLists.txt fix to remove redundant messages during configuration. I forgot to mention one useful thing that becomes possible when |
@imaami I don't think you need to rebase your PRs so often, the C generator doesn't get many patches. It can be a problem because it makes it harder to tell if there were new changes after my reviews. |
Everything looks good to me. I had noticed that one of the sample clients was ignoring my new build flags, but I didn't know why. Thank you for fixing that. |
That sounds good. I'm thinking we could enable |
No problem. From now on I'll only rebase if I can see there are changes in master that conflict with my branch, or if they change the generated code. It's a habit of mine, I mostly use rebase merges personally so it tends to show in the workflow. |
I usually enable at least
Side note: right now |
That's not what I meant. We need |
Yes, I guess that should be expected, there are too many issues for now. |
OK, I see. There's one catch about using With a little effort it's fairly easy to get both the full list of warnings and a CI failure: just log the console output during build without I've done a lot of bash scripting and have also implemented the above before so it's feasible if you ask me. I'm pretty sure I'll find time for it at some point if it sounds like a good option. |
The ci is just to catch regressions after we fix all the warnings. I'm always worried about this because I've fixed a few regressions lately that would have been obvious if anybody had checked the warnings, but the ci hides them. |
Does this PR still need changes? |
It looks good to me. |
Fixes
CMakeFiles.txt
so that the usual way to define custom C compile flags works. After the change users can set the initial value ofCMAKE_C_FLAGS
on the command line. Project-defined flags no longer replace the entire variable content but are appended instead. (Project flags still take priority if they need to override custom flags.)For example to build a local version with architecture-specific CPU flags:
cmake -B /tmp/build -S /usr/src/whatever -DCMAKE_C_FLAGS='.march=znver3 -mtune=znver3'
The first commit enables
CMakeLists.txt
to be (re-)generated for one of the three C clients. It's been disabled for quite a long time, and it doesn't look like there is an actual reason for it. But please let me know if there's breakage.