mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 05:38:24 -05:00
FortranCInterface: Make mangling detection robust to PIC Fortran
When using a Fortran compiler that produces PIC executables by default with a C compiler that does not produce PIC by default then the mangling detection executable fails to link. Explicitly enable PIC for the C compiler just in case the Fortran compiler needs it to link. Issue: #16405
This commit is contained in:
@@ -94,6 +94,9 @@ add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules})
|
|||||||
# Provide symbols through C but fall back to Fortran.
|
# Provide symbols through C but fall back to Fortran.
|
||||||
add_library(symbols STATIC ${symbol_sources})
|
add_library(symbols STATIC ${symbol_sources})
|
||||||
target_link_libraries(symbols myfort)
|
target_link_libraries(symbols myfort)
|
||||||
|
# In case the Fortran compiler produces PIC by default make sure
|
||||||
|
# the C compiler produces PIC even if it is not its default.
|
||||||
|
set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
|
||||||
|
|
||||||
# Require symbols through Fortran.
|
# Require symbols through Fortran.
|
||||||
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
|
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
|
||||||
|
|||||||
Reference in New Issue
Block a user