summaryrefslogtreecommitdiffstats
path: root/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/cmake/Modules/CompilerRTCompile.cmake')
-rw-r--r--compiler-rt/cmake/Modules/CompilerRTCompile.cmake10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
index 4885c82e765..2d1dd22e3dc 100644
--- a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
@@ -17,15 +17,21 @@ macro(clang_compile object_file source)
else()
string(REPLACE " " ";" global_flags "${CMAKE_C_FLAGS}")
endif()
+ # On Windows, CMAKE_*_FLAGS are built for MSVC but we use the GCC clang.exe
+ # which doesn't support flags starting with "/smth". Replace those with
+ # "-smth" equivalents.
+ if(MSVC)
+ string(REGEX REPLACE "^/" "-" global_flags "${global_flags}")
+ string(REPLACE ";/" ";-" global_flags "${global_flags}")
+ endif()
# Ignore unknown warnings. CMAKE_CXX_FLAGS may contain GCC-specific options
# which are not supported by Clang.
list(APPEND global_flags -Wno-unknown-warning-option)
set(compile_flags ${global_flags} ${SOURCE_CFLAGS})
add_custom_command(
OUTPUT ${object_file}
- # MSVS CL doesn't allow a space between -Fo and the object file name.
COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c
- ${COMPILER_RT_TEST_COMPILER_OBJ}"${object_file}"
+ -o "${object_file}"
${source_rpath}
MAIN_DEPENDENCY ${source}
DEPENDS ${SOURCE_DEPS})
OpenPOWER on IntegriCloud