diff options
author | Brad King <brad.king@kitware.com> | 2016-11-04 13:52:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-11-04 13:54:12 (GMT) |
commit | 80e477239dc3a57f87f9efb7b1d78eb0f0e2b6a3 (patch) | |
tree | 50ee33b5cefa6ba28c15bfdcef3efd5635883b06 /Modules | |
parent | 800a11dc3633b3ec91223c4b53bcc7817e63ad02 (diff) | |
download | CMake-80e477239dc3a57f87f9efb7b1d78eb0f0e2b6a3.zip CMake-80e477239dc3a57f87f9efb7b1d78eb0f0e2b6a3.tar.gz CMake-80e477239dc3a57f87f9efb7b1d78eb0f0e2b6a3.tar.bz2 |
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
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FortranCInterface/CMakeLists.txt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index dee57b5..3a66f68 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -94,6 +94,9 @@ add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules}) # Provide symbols through C but fall back to Fortran. add_library(symbols STATIC ${symbol_sources}) 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. add_executable(FortranCInterface main.F call_sub.f ${call_mod}) |