mirror of
https://github.com/reactos/CMake.git
synced 2025-01-27 06:42:32 +00:00
FortranCInt: Pass CONFIG flags to try_compile
This change ensures that Intel Fortran's /libs: in CMAKE_Fortran_FLAGS and Visual C++'s /MT or /MD in the CMAKE_C_FLAGS_RELEASE do not conflict with each other.
This commit is contained in:
parent
a83250880a
commit
2cfea104a6
@ -93,11 +93,12 @@ 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)
|
||||
target_link_libraries(symbols PUBLIC 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})
|
||||
target_link_libraries(FortranCInterface symbols)
|
||||
target_link_libraries(FortranCInterface PUBLIC symbols)
|
||||
|
@ -27,6 +27,7 @@ unset(FortranCInterface_VERIFIED_CXX CACHE)
|
||||
set(_result)
|
||||
|
||||
# Build a sample project which reports symbols.
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
|
||||
try_compile(FortranCInterface_COMPILED
|
||||
${FortranCInterface_BINARY_DIR}
|
||||
${FortranCInterface_SOURCE_DIR}
|
||||
@ -35,6 +36,8 @@ try_compile(FortranCInterface_COMPILED
|
||||
CMAKE_FLAGS
|
||||
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
|
||||
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
||||
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
|
||||
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
|
||||
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
|
||||
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
|
||||
unset(FortranCInterface_COMPILED CACHE)
|
||||
@ -43,7 +46,7 @@ unset(FortranCInterface_COMPILED CACHE)
|
||||
if(FortranCInterface_COMPILED)
|
||||
find_program(FortranCInterface_EXE
|
||||
NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX}
|
||||
PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug
|
||||
PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
set(FortranCInterface_EXE ${FortranCInterface_EXE})
|
||||
|
Loading…
x
Reference in New Issue
Block a user