Skip to content
Snippets Groups Projects
CMakeLists.txt 1.57 KiB
cmake_minimum_required(VERSION 3.20)
project(Detection_eddies LANGUAGES Fortran)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release Profile
  RelWithDebInfo)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(NetCDF_Fortran REQUIRED)
find_package(MPI)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
  find_package(Jumble REQUIRED CONFIG)
  find_package(NetCDF95 REQUIRED CONFIG)
  find_package(Contour_531 REQUIRED CONFIG)
  find_package(Shapelib_03 REQUIRED CONFIG)
  find_package(Geometry REQUIRED CONFIG)
  find_package(Numer_Rec_95 REQUIRED CONFIG)
  find_package(GPC_F REQUIRED CONFIG)
endif()

if(NOT TARGET fortranGIS)
  # Some test programs use fortrangis and do not use Shapelib_03:
  find_package(fortrangis REQUIRED CONFIG)
endif()

if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
  STRING(FIND ${CMAKE_Fortran_FLAGS_DEBUG} invalid index)
  
  if(NOT ${index} EQUAL -1)
    message(WARNING "We cannot use -ffpe-trap=invalid because of GFortran bug "
      "with quiet NaNs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70817")
  endif()
endif()

# test_write_null
add_executable(test_write_null test_write_null.f90)
target_link_libraries(test_write_null PRIVATE Shapelib_03::shapelib_03
  Contour_531::contour_531 Jumble::jumble)
set_target_properties(test_write_null PROPERTIES Fortran_MODULE_DIRECTORY
  ${CMAKE_CURRENT_BINARY_DIR}/test_write_null_modules)
target_include_directories(test_write_null PRIVATE
  ${CMAKE_CURRENT_BINARY_DIR}/test_write_null_modules)

add_subdirectory(Inst_eddies)
add_subdirectory(Overlap)
add_subdirectory(Common)
include(TAGS)