Skip to content

Conversation

@7schroet
Copy link

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 lines

set( ${PNAME}_Fortran_FLAGS "${${PNAME}_Fortran_FLAGS} ${ECBUILD_Fortran_FLAGS}" )
set( ${PNAME}_Fortran_FLAGS_BIT "${${PNAME}_Fortran_FLAGS_BIT} ${ECBUILD_Fortran_FLAGS_BIT}" )
set( ${PNAME}_Fortran_FLAGS_DEBUG "${${PNAME}_Fortran_FLAGS_DEBUG} ${ECBUILD_Fortran_FLAGS_DEBUG}" )

don'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_FLAGS property, 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_FLAGS property.

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!

@github-actions github-actions bot requested review from reuterbal and rjhogan July 14, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant