Skip to content
Snippets Groups Projects
  • Lionel GUEZ's avatar
    60ab47a7
    Ask for option `-assume noold_maxminloc` · 60ab47a7
    Lionel GUEZ authored
    Ask for option `-assume noold_maxminloc` of Intel compiler. Without
    this option, in procedure `set_max_speed`, if the speed values of all
    the contours are NaN then the compiler wrongly sets `i` to 1 instead
    of 0 at line 142, so `max_speed` is set to NaN instead of
    `missing_speed` and the speed contour is wrong.
    60ab47a7
    History
    Ask for option `-assume noold_maxminloc`
    Lionel GUEZ authored
    Ask for option `-assume noold_maxminloc` of Intel compiler. Without
    this option, in procedure `set_max_speed`, if the speed values of all
    the contours are NaN then the compiler wrongly sets `i` to 1 instead
    of 0 at line 142, so `max_speed` is set to NaN instead of
    `missing_speed` and the speed contour is wrong.
CMakeLists.txt 2.11 KiB
cmake_minimum_required(VERSION 3.20...3.27)
project(Detection_eddies LANGUAGES Fortran)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release Profile
  RelWithDebInfo)
include(FetchContent)
FetchContent_Declare(LG_cmake_utils GIT_REPOSITORY
  https://gitlab.in2p3.fr/guez/cmake.git GIT_TAG 517d97c3)
FetchContent_MakeAvailable(LG_cmake_utils)
list(APPEND CMAKE_MODULE_PATH "${lg_cmake_utils_SOURCE_DIR}")
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()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel|IntelLLVM)
   STRING(FIND ${CMAKE_Fortran_FLAGS} noold_maxminloc index)
   if(${index} EQUAL -1)
    message(WARNING "We need -assume noold_maxminloc because of Intel compiler "
      "bug: "
      "https://community.intel.com/t5/Intel-Fortran-Compiler/Incorrect-minloc-maxloc-results-with-ifx-2024-0/m-p/1549287")
  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)