Skip to content
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

Append to rather than set CXXFLAGS, etc. #242

Closed
ambrad opened this issue Aug 23, 2022 · 4 comments · Fixed by #243
Closed

Append to rather than set CXXFLAGS, etc. #242

ambrad opened this issue Aug 23, 2022 · 4 comments · Fixed by #243
Labels
bug Something isn't working

Comments

@ambrad
Copy link
Member

ambrad commented Aug 23, 2022

Here:

if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set (FFLAGS "-warn all -diag-disable=remark -fpscomp logicals")
set (CXXFLAGS "-Wall -diag-disable=remark")
else()
set (FFLAGS -Wall)
set (CXXFLAGS -Wall)
endif()
CXXFLAGS is being set rather than string-appended to. This overwrites flags from E3SM's cime_config cmake files.

@ambrad ambrad added the bug Something isn't working label Aug 23, 2022
@ambrad
Copy link
Member Author

ambrad commented Aug 23, 2022

Lines of this sort:

set(argsMv FLAGS FFLAGS CFLAGS CXXFLAGS LDFLAGS)
are also a problem.

@ambrad
Copy link
Member Author

ambrad commented Aug 23, 2022

Never mind; this can't be it. CXXFLAGS is empty on entry to ekat/CMakeLists.txt.

@ambrad ambrad closed this as completed Aug 23, 2022
@bartgol bartgol reopened this Aug 24, 2022
@bartgol
Copy link
Contributor

bartgol commented Aug 24, 2022

I think this might be an issue. Macros do not create new scopes, so using a very common name like CXXFLAGS in that macro will alter the value of a potential homonymous var at the call site.

@bartgol
Copy link
Contributor

bartgol commented Aug 24, 2022

I confirmed that this is an issue. I put

set (CXXFLAGS "hello world")

at the top of scream's CMakeLists.txt, and printed its value at the bottom, where it showed -Wall instead of hello world. I will fix this right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants