build(cmake): use add_compile_options not C_FLAGS - #364
Conversation
CMake does not recommend modifying CMAKE_C_FLAGS directly if we can help it. Instead, we should be using add_compile_options(). This also means that we no longer overwrite CMAKE_C_FLAGS, which will mean that `edgesec` works better with other build systems (e.g. pdebuild).
Codecov Report
@@ Coverage Diff @@
## main #364 +/- ##
==========================================
+ Coverage 51.77% 51.80% +0.02%
==========================================
Files 139 139
Lines 19318 19318
==========================================
+ Hits 10002 10007 +5
+ Misses 9316 9311 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
mereacre
left a comment
There was a problem hiding this comment.
From cmake docs:
The preprocessor definitions are added to the COMPILE_DEFINITIONS directory property for the current CMakeLists file. They are also added to the COMPILE_DEFINITIONS target property for each target in the current CMakeLists file.
In the cheri-pure branch I add compiler flags CMAKE_C_FLAGS in cheri-cross.cmake file located in CMakeToolchains. Now the question is will they be applied to the entire project?
Yes, CMake Toolchain files are applied globally. The |
CMake does not recommend modifying
CMAKE_C_FLAGSdirectly if we can help it. Instead, we should be usingadd_compile_options().This also means that we no longer overwrite
CMAKE_C_FLAGS, which will mean thatedgesecworks better with other build systems (e.g. pdebuild).Depends on #360 and #363 (since we no longer overwrite
CMAKE_C_FLAGS, some of the debian build's C_FLAGS cause errors that need to be fixed).