diff --git a/CMakeLists.txt b/CMakeLists.txt index cf91a7ab..1e509e44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ set(lib_name ${PROJECT_NAME}) include(GNUInstallDirs) # Handle user build options. +option(OPENMP "Use OpenMP threading" OFF) option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(FTP_TEST_FILES "Fetch and test with files on FTP site." OFF) @@ -21,6 +22,7 @@ option(LOGGING "Turn on internal logging messages. Only useful to g2 developers. option(BUILD_4 "Build libg2_4.a" ON) option(BUILD_D "Build libg2_d.a" ON) option(BUILD_WITH_W3EMC "Build with NCEPLIBS-w3emc, enabling some GRIB1 functionality" ON) +option(G2C_COMPARE "Enable copygb2 tests using g2c_compare" OFF) # Developers can use this option to specify a local directory which # holds the test files. They will be copied instead of fetching the @@ -61,14 +63,24 @@ if(${CMAKE_Fortran_COMPILER_ID} MATCHES "^(GNU)$" AND ${CMAKE_Fortran_COMPILER_V set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch") endif() +# Find openMP if we need it. +if(OPENMP) + find_package(OpenMP REQUIRED COMPONENTS Fortran) +endif() + # There was a bug in jasper for the intel compiler that was fixed in # 2.0.25. find_package(Jasper 2.0.25 REQUIRED) find_package(PNG REQUIRED) find_package(bacio REQUIRED) +find_package(ZLIB REQUIRED) if(bacio_VERSION LESS 2.5.0) add_library(bacio::bacio ALIAS bacio::bacio_4) endif() +find_package(ip 3.3.3 REQUIRED) +if(ip_VERSION LESS 5.0) + find_package(sp 2.3.3 REQUIRED) +endif() # NCEPLIBS-w3emc may be required. if (BUILD_WITH_W3EMC) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 32446d9b..a0d1e77e 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -3,22 +3,13 @@ # # George Gayno, Mark Potts, Alyson Stahl -# Set the compiler flags. -if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$") - set(CMAKE_Fortran_FLAGS "-g -r8 -auto ${CMAKE_Fortran_FLAGS}") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${CMAKE_Fortran_FLAGS}") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") - set(CMAKE_Fortran_FLAGS "-g -fdefault-real-8 ${CMAKE_Fortran_FLAGS}") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${CMAKE_Fortran_FLAGS}") -endif() - # This is the fortran source code. set(fortran_src copygb.F90) # Build the executable. set(exe_name copygb) add_executable(${exe_name} ${fortran_src}) -target_link_libraries(${exe_name} PRIVATE bacio::${bacio_name} w3emc::w3emc_d ip::ip_d) +target_link_libraries(${exe_name} PRIVATE bacio::bacio w3emc::w3emc_d ip::ip_d) if(ip_VERSION LESS 5.0) target_link_libraries(${exe_name} PRIVATE sp::sp_d) endif()