瀏覽代碼

LFortran: Update flags renamed by version 0.55

The `--generate-object-code` flag is now `--separate-compilation`.

Fixes: #27225
Christopher Albert 1 月之前
父節點
當前提交
7e8f76dad2

+ 6 - 1
Modules/FortranCInterface/CMakeLists.txt

@@ -104,7 +104,12 @@ target_link_libraries(symbols PUBLIC myfort)
 set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
 
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
-  add_compile_options(--implicit-interface --generate-object-code)
+  if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "0.55")
+    set(_LFORTRAN_SC_FLAG --separate-compilation)
+  else()
+    set(_LFORTRAN_SC_FLAG --generate-object-code)
+  endif()
+  add_compile_options(--implicit-interface ${_LFORTRAN_SC_FLAG})
 endif()
 
 # Require symbols through Fortran.

+ 6 - 1
Modules/FortranCInterface/Verify/CMakeLists.txt

@@ -5,7 +5,12 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION})
 project(VerifyFortranC C Fortran)
 
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
-  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:--generate-object-code>")
+  if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "0.55")
+    set(_LFORTRAN_SC_FLAG --separate-compilation)
+  else()
+    set(_LFORTRAN_SC_FLAG --generate-object-code)
+  endif()
+  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:${_LFORTRAN_SC_FLAG}>")
 endif()
 
 option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)

+ 6 - 1
Tests/Fortran/CMakeLists.txt

@@ -38,7 +38,12 @@ if(WIN32 AND NOT CYGWIN)
 endif()
 
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
-  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:--implicit-interface;--generate-object-code>")
+  if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "0.55")
+    set(_LFORTRAN_SC_FLAG --separate-compilation)
+  else()
+    set(_LFORTRAN_SC_FLAG --generate-object-code)
+  endif()
+  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:--implicit-interface;${_LFORTRAN_SC_FLAG}>")
 endif()
 
 add_library(hello STATIC hello.f)

+ 6 - 1
Tests/FortranOnly/CMakeLists.txt

@@ -9,7 +9,12 @@ if("${CMAKE_Fortran_COMPILER_ID};${CMAKE_Fortran_SIMULATE_ID}" MATCHES "^Intel(L
 endif()
 
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
-  add_compile_options(--implicit-interface --generate-object-code)
+  if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "0.55")
+    set(_LFORTRAN_SC_FLAG --separate-compilation)
+  else()
+    set(_LFORTRAN_SC_FLAG --generate-object-code)
+  endif()
+  add_compile_options(--implicit-interface ${_LFORTRAN_SC_FLAG})
 endif()
 
 # create a library with hello and world functions

+ 6 - 1
Tests/Module/CheckIPOSupported-Fortran/CMakeLists.txt

@@ -4,7 +4,12 @@ project(CheckIPOSupported-Fortran LANGUAGES Fortran)
 cmake_policy(SET CMP0069 NEW)
 
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
-  add_compile_options(--implicit-interface --generate-object-code)
+  if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "0.55")
+    set(_LFORTRAN_SC_FLAG --separate-compilation)
+  else()
+    set(_LFORTRAN_SC_FLAG --generate-object-code)
+  endif()
+  add_compile_options(--implicit-interface ${_LFORTRAN_SC_FLAG})
 endif()
 
 include(CheckIPOSupported)

+ 6 - 1
Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt

@@ -26,7 +26,12 @@ target_link_libraries(sunq sunquad)
 endfunction()
 
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
-  add_compile_options(--implicit-interface --generate-object-code)
+  if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "0.55")
+    set(_LFORTRAN_SC_FLAG --separate-compilation)
+  else()
+    set(_LFORTRAN_SC_FLAG --generate-object-code)
+  endif()
+  add_compile_options(--implicit-interface ${_LFORTRAN_SC_FLAG})
 endif()
 
 # check for the fortran c interface mangling