-
Notifications
You must be signed in to change notification settings - Fork 181
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] Attach warnings to remaining targets #1954
base: master
Are you sure you want to change the base?
[cmake] Attach warnings to remaining targets #1954
Conversation
Thanks for making the effort! So I am wondering, if the approach of the warnings target is really the best in this case. It would also allow to remove a lot of boilerplate code from main CMakeLists.txt. These files could be passed into anything which is build standalone... |
Yep, so the problem with There are two things at play here. Flags for all code including the dependencies, things like sanitizers are suited here as you want to know about problems from everywhere. Typically set at the command line / CMakePreset level with Flags the eCAL team want to apply to their code for development . I.e.: the compiler warnings. Things that shouldn't be pushed onto any in-build-tree dependencies. This is what I was attempting to address by adding the warning flags on a target-level. There is a third viewpoint as well, packagers, who don't care about the projects development practices and just want the software to build. They are typically only concerned about the flags being used when it stops a build (i.e: don't set warnings as error by default!) Having warnings explicitly on a target-by-target level also means you need not apply them to generated (or other) code (I'm looking at you, Another advantage of warnings targets is that you could have more than one! I've never actually seen that done, but you could have, say, a baseline level and a strict one for critical code 🤷
That was the idea with the I would say the design goals are:
To achieve all that and incorporate your suggestion I propose continuing down the path as originally laid out, with the addition of replacing the flag selection logic (i.e: the
*This could be something like EDIT: CMAKE_PROJECT_eCAL_INCLUDE could also work if you set that to a file that sets up "developer mode" Sorry for the wall of text... 😅 Ps: This whole thing becomes moot if dependencies aren't built from source but come from Conan/vcpkg/system 😉 |
Description
Follow up from #1948 -- makes sure all (C/C++) eCAL targets have the warnings set on them.
Detailed changes:
eCAL::*
alias targets into theecal_add_*
helpers.PUBLIC/PRIVATE
access specifiers on a few targetsI couldn't decide on the best way to handle the goal to make parts of the repo more standalone whilst also having a single source of truth. So ended up with three approaches.
/app
and/contrib
I used theecal_add_*
helpers as they were already being used in places./lib
I usedecal_add_compiler_warnings
if it was available, otherwise issued a warning./ecal/service
it appeared effort was made to make it standalone, so I check for ifhelper_functions/ecal_compiler_warnings
can be included:_ecal_warnings
target via a compatibility alias_ecal_service_warnings
Not sure what would be preferred, personally I would use the helpers everywhere and just carry those helper functions into the new split off repo.
Related issues
Cherry-pick to