cucumber / cucumber-cpp

Support for writing Cucumber step definitions in C++
MIT License
308 stars 131 forks source link

Remove CACHE FORCE arguments from CMAKE_CXX_FLAG on colored terminal output #232

Closed alexcani closed 3 years ago

alexcani commented 4 years ago

Remove CACHE FORCE arguments from CMAKE_CXX_FLAG on colored terminal output

Summary

By using CACHE STRING "" FORCE on 'set' command this updated CMAKE_CXX_FLAG on any parent directory, thus leaking internal configuration into external projects that may be using cucumber-cpp through add_directory.

Details

An example is -Werror -Wall -Wextra flags set on "Generic Compiler Flags". In a Unix + Ninja + GCC environment those flags would leak into parent directories

Motivation and Context

How Has This Been Tested?

Types of changes

Checklist:

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 62.47% when pulling c8a35c329da42ac3c6bb92f18cc641fa4fb49e51 on alexcani:fix_cxx_flag_leak into dd424c1a900cb41c5db9d481714eb3471ce195e3 on cucumber:master.

jermus67 commented 3 years ago

@muggenhor, (if you're still reading along and can find some time) can you elaborate on why the CACHE STRING "" FORCE was part of setting the CMAKE_CXX_FLAGS?

I somehow cannot deduce from the the cmake documentation that this bleeds into the external / calling project, but that may be an implicit property of a cached variable (i.e. always being set at the highest level and not for the current directory only).

aslakhellesoy commented 3 years ago

Hi @alexcani,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

On behalf of the Cucumber core team, Aslak Hellesøy Creator of Cucumber

muggenhor commented 3 years ago

@muggenhor, (if you're still reading along and can find some time) can you elaborate on why the CACHE STRING "" FORCE was part of setting the CMAKE_CXX_FLAGS?

I somehow cannot deduce from the the cmake documentation that this bleeds into the external / calling project, but that may be an implicit property of a cached variable (i.e. always being set at the highest level and not for the current directory only).

Just noticed this message now (ever since our company switched to GitHub I get swamped in GH mails).

Anyway, I'm pretty sure this was a copy paste error on my side because a few other CMake projects that I used at the time injected CMAKE_*_FLAGS via the cache, so this was the only way to affect a change there. That wouldn't have applied here, but it affected my approach to thinking about CMake at the time.