1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

LFortran: Update flags renamed by version 0.55

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

Fixes: #27225
This commit is contained in:
Christopher Albert
2025-09-13 23:09:50 +02:00
committed by Brad King
parent 31fd368e80
commit 7e8f76dad2
6 changed files with 36 additions and 6 deletions

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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