FortranCInterface: Support '=' in language flags
The commit "FortranCInterface: Honor language flags in checks" taught the FortranCInterface module to pass C and Fortran flags into its detection and verification checks. We improve on the change to allow the '=' character in the language flags. This requires passing the cache entry type with the -D options.
This commit is contained in:
parent
8a87458954
commit
0306080e6e
|
@ -248,9 +248,9 @@ function(FortranCInterface_VERIFY)
|
||||||
VerifyFortranC
|
VerifyFortranC
|
||||||
CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx}
|
CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx}
|
||||||
-DCMAKE_VERBOSE_MAKEFILE=ON
|
-DCMAKE_VERBOSE_MAKEFILE=ON
|
||||||
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
|
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
|
||||||
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
|
"-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}"
|
||||||
"-DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}"
|
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
||||||
OUTPUT_VARIABLE _output)
|
OUTPUT_VARIABLE _output)
|
||||||
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")
|
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ try_compile(FortranCInterface_COMPILED
|
||||||
${FortranCInterface_SOURCE_DIR}
|
${FortranCInterface_SOURCE_DIR}
|
||||||
FortranCInterface
|
FortranCInterface
|
||||||
CMAKE_FLAGS
|
CMAKE_FLAGS
|
||||||
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
|
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
|
||||||
"-DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}"
|
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
||||||
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
|
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
|
||||||
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
|
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
|
||||||
unset(FortranCInterface_COMPILED CACHE)
|
unset(FortranCInterface_COMPILED CACHE)
|
||||||
|
|
|
@ -13,11 +13,11 @@ file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterface)
|
||||||
|
|
||||||
if(FortranC_TEST_FLAGS)
|
if(FortranC_TEST_FLAGS)
|
||||||
# Test whether FortranCInterface checks see C flags.
|
# Test whether FortranCInterface checks see C flags.
|
||||||
set(ENV{TEST_OPT_CC} "--test-opt-cc")
|
set(ENV{TEST_OPT_CC} "--test-opt-cc=1")
|
||||||
set(CMAKE_C_FLAGS "$ENV{TEST_OPT_CC}")
|
set(CMAKE_C_FLAGS "$ENV{TEST_OPT_CC}")
|
||||||
|
|
||||||
# Test whether FortranCInterface checks see Fortran flags.
|
# Test whether FortranCInterface checks see Fortran flags.
|
||||||
set(ENV{TEST_OPT_FC} "--test-opt-fc")
|
set(ENV{TEST_OPT_FC} "--test-opt-fc=1")
|
||||||
set(CMAKE_Fortran_FLAGS "$ENV{TEST_OPT_FC}")
|
set(CMAKE_Fortran_FLAGS "$ENV{TEST_OPT_FC}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue