Skip to content

Commit

Permalink
ccpp/CMakeLists.txt: bugfixes for new compile_cmake.sh build script t…
Browse files Browse the repository at this point in the history
…hat sets netCDF variables differently than the old compile.sh script
  • Loading branch information
climbfuji committed Dec 12, 2019
1 parent 4b05c32 commit de99568
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,20 @@ endif(MKL_DIR)

#------------------------------------------------------------------------------
# Set netCDF flags for preprocessor, compiler and linker (if defined)
# Legacy settings for old make build
if(NETCDF_DIR)
set (NETCDF_INC "-I${NETCDF_DIR}/include")
set (NETCDF_LIB "-L${NETCDF_DIR}/lib -lnetcdff -lnetcdf")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${NETCDF_INC} ${NETCDF_LIB}")
ADD_DEFINITIONS(-DNETCDF)
message (STATUS "Enable netCDF support")
# Settings for new cmake build
elseif (NETCDF_INC_DIR AND NETCDF_LIBDIR)
set (NETCDF_INC "-I${NETCDF_INC_DIR}")
set (NETCDF_LIB "-L${NETCDF_LIBDIR} -lnetcdff -lnetcdf")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${NETCDF_INC} ${NETCDF_LIB}")
ADD_DEFINITIONS(-DNETCDF)
message (STATUS "Enable netCDF support")
else(NETCDF_DIR)
message (STATUS "Disable netCDF support")
endif(NETCDF_DIR)
Expand Down

0 comments on commit de99568

Please sign in to comment.