diff --git a/CMakeLists.txt b/CMakeLists.txt index f9440a31..aae9d1df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,11 @@ else() find_package(g2c REQUIRED) endif() +# Set a pre-processor symbol if we are using g2c API. +if (USE_G2C_API) + add_definitions(-DG2C_API) +endif() + # Figure whether user wants a _4, a _d, or both libraries. if(BUILD_4 AND BUILD_D) set(kinds "4" "d") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12a0e0e0..fd60cc3e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,7 +9,12 @@ g2grids.F90 g2get.F90 g2getgb2.F90 g2index.F90 g2gf.F90 g2unpack.F90 g2create.F90 ${CMAKE_CURRENT_BINARY_DIR}/gribmod.F90 gridtemplates.F90 intmath.F90 g2jpc.F90 pack_gp.f params_ecmwf.F90 params.F90 pdstemplates.F90 g2png.F90 realloc.F90 reduce.f g2sim.F90 skgb.F90 -g2spec.F90 g2logging.F90 g2cf.F90 g2c_interface.F90) +g2spec.F90 g2logging.F90) + +# Add the G2C API code if required. +if (USE_G2C_API) + set(fortran_src ${fortran_src} g2cf.F90 g2c_interface.F90) +endif() # This function calls NCEPLIBS-w3emc. if (BUILD_WITH_W3EMC)