Add default flags to CMake build types #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One option to address #46.
Replaces the "custom compilation flags" approach that is currently used in ecRad's build system. This approach requires the project to set
ECRAD_ECBUILD_COMPILE_FLAGS, but setting this variable has the effect that "default compilation flags are not loaded" (see ecBuild docs). Due to this, none of the build types contain any optimization flags, and these linesdon't do anything either, as the
ECBUILD_*_FLAGS*values are not defined/empty.The benefit of the previously used approach with the custom flags is that one could override flags on a per-file basis, but this feature has not been used anywhere as far as I can tell (it would require the usage of the
OVERRIDE_COMPILE_FLAGSproperty, which I did not find anywhere in ecRad).Adding additional compile flags to source files is still possible via normal CMake mechanisms with the
COMPILE_OPTIONS/COMPILE_FLAGSproperty.To fix the problem raised in #46, there are (at least) two options. The first one is presented in this PR. The second one would be to properly define default flags, which would most likely amount to copy-pasting some ecBuild default values. Since the override feature for the custom flags was not used, I went with the first option. If however you intend to use the override feature in the near future, I would gladly close this PR and open a new one with the second option and properly defined default flags.
Let me know what you think!