LFortran: Remove hard-coded --generate-object-code flag
This was added in commit 98d0f918ba
(LFortran: Add support for this
compiler, 2024-01-25, v3.31.0-rc1~303^2~2) because it is needed for
cases covered by CMake's Fortran tests. However, it does not work
with Fortran modules and breaks lfortran's own `examples/project1`.
Move the flag to the test cases that need it, just as the original
commit did with `--implicit-interface`.
Fixes: #26597
Co-authored-by: Brad King <brad.king@kitware.com>
This commit is contained in:
parent
41abd532b6
commit
daf6cc89ee
@ -9,6 +9,6 @@ set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
|
||||
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "--cpp")
|
||||
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "--no-cpp")
|
||||
set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> --cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> --cpp-infer <DEFINES> <INCLUDES> <FLAGS> --generate-object-code -c <SOURCE> -o <OBJECT>")
|
||||
set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> --cpp-infer <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> -o <OBJECT>")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "--shared")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-export-dynamic")
|
||||
|
@ -101,7 +101,7 @@ 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)
|
||||
add_compile_options(--implicit-interface --generate-object-code)
|
||||
endif()
|
||||
|
||||
# Require symbols through Fortran.
|
||||
|
@ -4,6 +4,10 @@
|
||||
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>")
|
||||
endif()
|
||||
|
||||
option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
|
||||
if(VERIFY_CXX)
|
||||
enable_language(CXX)
|
||||
|
@ -38,7 +38,7 @@ if(WIN32 AND NOT CYGWIN)
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:--implicit-interface>")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:--implicit-interface;--generate-object-code>")
|
||||
endif()
|
||||
|
||||
add_library(hello STATIC hello.f)
|
||||
|
@ -8,7 +8,7 @@ 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)
|
||||
add_compile_options(--implicit-interface --generate-object-code)
|
||||
endif()
|
||||
|
||||
# create a library with hello and world functions
|
||||
|
@ -4,7 +4,7 @@ project(CheckIPOSupported-Fortran LANGUAGES Fortran)
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
|
||||
add_compile_options(--implicit-interface)
|
||||
add_compile_options(--implicit-interface --generate-object-code)
|
||||
endif()
|
||||
|
||||
include(CheckIPOSupported)
|
||||
|
@ -26,7 +26,7 @@ target_link_libraries(sunq sunquad)
|
||||
endfunction()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
|
||||
add_compile_options(--implicit-interface)
|
||||
add_compile_options(--implicit-interface --generate-object-code)
|
||||
endif()
|
||||
|
||||
# check for the fortran c interface mangling
|
||||
|
Loading…
Reference in New Issue
Block a user