FortranCInterface: Honor language flags in checks

We pass CMAKE_C_FLAGS, CMAKE_CXX_FLAGS, and CMAKE_Fortran_FLAGS through
try_compile() for the FortranCInterface Detect and Verify projects.
This honors user-specified compiler flags for each language, thus
supporting flags that affect the Fortran mangling.
This commit is contained in:
Brad King 2009-11-19 17:42:48 -05:00
parent 7c9e5ba37f
commit 1699836b06
2 changed files with 6 additions and 0 deletions

View File

@ -248,6 +248,9 @@ function(FortranCInterface_VERIFY)
VerifyFortranC
CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx}
-DCMAKE_VERBOSE_MAKEFILE=ON
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
"-DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}"
OUTPUT_VARIABLE _output)
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")

View File

@ -39,6 +39,9 @@ try_compile(FortranCInterface_COMPILED
${FortranCInterface_BINARY_DIR}
${FortranCInterface_SOURCE_DIR}
FortranCInterface
CMAKE_FLAGS
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
"-DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}"
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)