cmake_minimum_required(VERSION 3.19) # Get the version from the VERSION file. #file(STRINGS "VERSION" pVersion) set(pVersion 7.0.0) project( wafs VERSION ${pVersion} LANGUAGES Fortran) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(GNUInstallDirs) # Build type if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() # Find packages. find_package(bacio REQUIRED) find_package(w3emc REQUIRED) find_package(sp REQUIRED) find_package(ip REQUIRED) find_package(g2 REQUIRED) find_package(bufr REQUIRED) # Set compiler flags. if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check -check bounds -check noarg_temp_created -check nopointer -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -fbacktrace") set(CMAKE_Fortran_FLAGS_RELEASE "-O2") set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") endif() # Build wafs utilities. add_subdirectory(wafs_blending_0p25.fd) add_subdirectory(wafs_cnvgrib2.fd) add_subdirectory(wafs_gcip.fd) add_subdirectory(wafs_makewafs.fd)