diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index a2ef08e48..812e3198a 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -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}") diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 70dbe2735..0f964a906 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -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)