diff --git a/Fortran/gfortran/CMakeLists.txt b/Fortran/gfortran/CMakeLists.txt --- a/Fortran/gfortran/CMakeLists.txt +++ b/Fortran/gfortran/CMakeLists.txt @@ -342,10 +342,13 @@ # other diagnostics, it will be empty. set(out ${target}.out) + # CMake escapes spaces. To really get a space (between arguments) use a ; + string(REPLACE " " ";" env_fflags ${CMAKE_Fortran_FLAGS}) + add_custom_command( OUTPUT ${out} COMMAND ${CMAKE_COMMAND} - -DCMD="${CMAKE_Fortran_COMPILER};-c;${fflags};${ldflags};${others};${main}" + -DCMD="${CMAKE_Fortran_COMPILER};-c;${env_fflags};${fflags};${ldflags};${others};${main}" -DALWAYS_SAVE_DIAGS=OFF -DWORKING_DIRECTORY=${working_dir} -DOUTPUT_FILE=${out}