mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 03:59:58 +00:00
Honor real language flags in FortranC.Flags test
The test overrides the CMAKE_C_FLAGS and CMAKE_Fortran_FLAGS to test passing a specific flag to the compiler wrapper scripts. We fix it to honor any outside flags needed for the real compiler.
This commit is contained in:
parent
0306080e6e
commit
1ac1058272
@ -15,11 +15,14 @@
|
||||
if(NOT DEFINED CMAKE_Fortran_COMPILER)
|
||||
set(_desc "Looking for a Fortran compiler")
|
||||
message(STATUS ${_desc})
|
||||
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran/CMakeLists.txt"
|
||||
"cmake_minimum_required(VERSION 2.4)
|
||||
project(CheckFortran Fortran)
|
||||
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
|
||||
\"set(CMAKE_Fortran_COMPILER \\\"\${CMAKE_Fortran_COMPILER}\\\")\\n\")
|
||||
\"set(CMAKE_Fortran_COMPILER \\\"\${CMAKE_Fortran_COMPILER}\\\")\\n\"
|
||||
\"set(CMAKE_Fortran_FLAGS \\\"\${CMAKE_Fortran_FLAGS}\\\")\\n\"
|
||||
)
|
||||
")
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran
|
||||
@ -42,4 +45,6 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
|
||||
message(STATUS "${_desc} - ${CMAKE_Fortran_COMPILER}")
|
||||
set(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}" CACHE FILEPATH "Fortran compiler")
|
||||
mark_as_advanced(CMAKE_Fortran_COMPILER)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" CACHE STRING "Fortran flags")
|
||||
mark_as_advanced(CMAKE_Fortran_FLAGS)
|
||||
endif()
|
||||
|
@ -14,11 +14,11 @@ file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterface)
|
||||
if(FortranC_TEST_FLAGS)
|
||||
# Test whether FortranCInterface checks see C flags.
|
||||
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} ${CMAKE_C_FLAGS}")
|
||||
|
||||
# Test whether FortranCInterface checks see Fortran flags.
|
||||
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} ${CMAKE_Fortran_FLAGS}")
|
||||
endif()
|
||||
|
||||
include(FortranCInterface)
|
||||
|
@ -12,15 +12,14 @@ configure_file("${src}/test_opt.sh.in" "${bld}/fc.sh" @ONLY)
|
||||
set(ID)
|
||||
set(COMMAND)
|
||||
|
||||
set(ENV{CFLAGS})
|
||||
set(ENV{FFLAGS})
|
||||
|
||||
execute_process(
|
||||
WORKING_DIRECTORY "${bld}"
|
||||
COMMAND ${CMAKE_COMMAND} "${src}" -G "@CMAKE_TEST_GENERATOR@"
|
||||
"-DFortranC_TEST_FLAGS=1"
|
||||
"-DCMAKE_C_COMPILER=${bld}/cc.sh"
|
||||
"-DCMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@"
|
||||
"-DCMAKE_Fortran_COMPILER=${bld}/fc.sh"
|
||||
"-DCMAKE_Fortran_FLAGS:STRING=@CMAKE_Fortran_FLAGS@"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user