diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79a6fa9b7636501cfb4216e044b8796690dd3401..9018a9940ffdbc7723bbbcaa0062dcaae714f1e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,23 @@ 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)
+
+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()
+
 include(FetchContent)
 FetchContent_Declare(LG_cmake_utils GIT_REPOSITORY
   https://gitlab.in2p3.fr/guez/cmake.git GIT_TAG 517d97c3)
@@ -41,22 +58,6 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
   endif()
 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