Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake =================================================================== --- compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -289,7 +289,7 @@ set(output_file_${libname} ${output_name_${libname}}${CMAKE_C_OUTPUT_EXTENSION}) foreach(substitution ${substitutions}) if(substitution STREQUAL "") - string(REPLACE "" "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" + string(REPLACE "" "\"${CMAKE_C_COMPILER}\" ${CMAKE_C_COMPILER_ARG1}" compile_command_${libname} ${compile_command_${libname}}) elseif(substitution STREQUAL "") string(REPLACE "" "${output_dir_${libname}}/${output_file_${libname}}" @@ -305,7 +305,7 @@ ${compile_command_${libname}}) endif() endforeach() - separate_arguments(compile_command_${libname}) + separate_arguments(compile_command_${libname} NATIVE_COMMAND ${compile_command_${libname}}) add_custom_command( OUTPUT ${output_dir_${libname}}/${output_file_${libname}} COMMAND ${compile_command_${libname}} Index: llvm/cmake/modules/AddLLVM.cmake =================================================================== --- llvm/cmake/modules/AddLLVM.cmake +++ llvm/cmake/modules/AddLLVM.cmake @@ -101,11 +101,11 @@ # FIXME: Don't write the "local:" line on OpenBSD. # in the export file, also add a linker script to version LLVM symbols (form: LLVM_N.M) add_custom_command(OUTPUT ${native_export_file} - COMMAND echo "LLVM_${LLVM_VERSION_MAJOR} {" > ${native_export_file} - COMMAND grep -q "[[:alnum:]]" ${export_file} && echo " global:" >> ${native_export_file} || : - COMMAND sed -e "s/$/;/" -e "s/^/ /" < ${export_file} >> ${native_export_file} - COMMAND echo " local: *;" >> ${native_export_file} - COMMAND echo "};" >> ${native_export_file} + COMMAND bash -c "echo 'LLVM_${LLVM_VERSION_MAJOR} {' > ${native_export_file}" + COMMAND bash -c "grep -q '[[:alnum:]]' ${export_file} && echo ' global:' >> ${native_export_file} || :" + COMMAND bash -c "sed -e 's/$/;/' -e 's/^/ /' < ${export_file} >> ${native_export_file}" + COMMAND bash -c "echo ' local: *;' >> ${native_export_file}" + COMMAND bash -c "echo '};' >> ${native_export_file}" DEPENDS ${export_file} VERBATIM COMMENT "Creating export file for ${target_name}")