File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,15 @@ foreach(ESMX_LINK_LIBRARY IN ITEMS ${ESMX_LINK_LIBRARIES})
160160  endif ()
161161endforeach ()
162162
163+ # CMake has a bug with NAG and OpenMP: 
164+ #   https://gitlab.kitware.com/cmake/cmake/-/issues/21280 
165+ # so we work around it ... credit to https://github.com/mathomp4 
166+ if  (OpenMP_Fortran_FOUND AND  CMAKE_Fortran_COMPILER_ID STREQUAL  "NAG" )
167+   message (WARNING "NAG Fortran detected, resetting OpenMP flags to avoid CMake bug" )
168+   set_property (TARGET  OpenMP::OpenMP_Fortran PROPERTY INTERFACE_LINK_LIBRARIES "" )
169+   set_property (TARGET  OpenMP::OpenMP_Fortran PROPERTY INTERFACE_LINK_OPTIONS "-openmp" )
170+ endif ()
171+ 
163172# link options 
164173if (DEFINED  ESMX_LINK_OPTIONS)
165174  target_link_options (esmx_driver PUBLIC  ${ESMX_LINK_OPTIONS} )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments