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

CMake compile options #327

Open
webisu opened this issue Feb 25, 2025 · 2 comments
Open

CMake compile options #327

webisu opened this issue Feb 25, 2025 · 2 comments
Assignees

Comments

@webisu
Copy link
Collaborator

webisu commented Feb 25, 2025

In the top level CMakelLists.txt

if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -traceback ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0")
elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_Fortran_FLAGS "-g -fbacktrace ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -O0")
endif()

has no effect on the actual compile options. Neither does add_compile_options().
However, if you copy the above code fragment to wgrib2/CMakeLists.txt then the
compiler options are enabled. Seems that

set(CMAKE_XXX_FLAGS,...)
only works for that directory.

cmake version 3.22.1
Ubuntu

@webisu webisu self-assigned this Feb 25, 2025
@webisu
Copy link
Collaborator Author

webisu commented Feb 25, 2025

Moving the cmake code that sets the compile options from CMakeLists.txt to wgrib2/CMakeLists.txt.
Merged some of the compile options from the pre-github version of wgrib2 concerning the math model.

@AlysonStahl-NOAA
Copy link
Collaborator

Did your recent PR (#329 ) fix this and #328 ?

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

No branches or pull requests

2 participants