Skip to content

Commit bbe12ad

Browse files
committed
[Fortran/gfortran] support environment flags in compile tests
Adding extra flags to compile tests is useful for testing out new features (e.g. -flang-experimental-hlfir) or increasing test coverage (e.g. running optimisation passes). Differential Revision: https://reviews.llvm.org/D155482
1 parent 7b5b5dc commit bbe12ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Fortran/gfortran/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ function(gfortran_add_compile_test expect_error main others fflags ldflags)
342342
# other diagnostics, it will be empty.
343343
set(out ${target}.out)
344344

345+
# Add the CMake-wide environment variable CMAKE_Fortran_FLAGS
346+
# CMake escapes spaces. To really get a space (between arguments) use a ;
347+
string(REPLACE " " ";" fflags ${fflags} ";" ${CMAKE_Fortran_FLAGS})
348+
345349
add_custom_command(
346350
OUTPUT ${out}
347351
COMMAND ${CMAKE_COMMAND}

0 commit comments

Comments
 (0)