[CMake] Use correct include flag for MSVC

When building using the MSVC driver, we need to use /imsvc rather than
-isystem for system headers.

Differential Revision: https://reviews.llvm.org/D134864
This commit is contained in:
Petr Hosek 2022-09-29 08:48:03 +00:00
parent 7dbdffefb7
commit bd0a35edfd
1 changed files with 2 additions and 2 deletions

View File

@ -559,7 +559,7 @@ if (COMPILER_RT_CXX_LIBRARY STREQUAL "libcxx")
append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ COMPILER_RT_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ COMPILER_RT_COMMON_LINK_FLAGS)
# Use the in-tree libc++ through explicit include and library paths.
set(COMPILER_RT_CXX_CFLAGS "$<$<TARGET_EXISTS:cxx-headers>:-isystem$<JOIN:$<TARGET_PROPERTY:cxx-headers,INTERFACE_INCLUDE_DIRECTORIES>,$<SEMICOLON>-isystem>>")
set(COMPILER_RT_CXX_CFLAGS "$<$<TARGET_EXISTS:cxx-headers>:$<IF:$<BOOL:${MSVC}>,/imsvc,-isystem>$<JOIN:$<TARGET_PROPERTY:cxx-headers,INTERFACE_INCLUDE_DIRECTORIES>,$<SEMICOLON>$<IF:$<BOOL:${MSVC}>,/imsvc,-isystem>>>")
if (COMPILER_RT_STATIC_CXX_LIBRARY)
set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:cxx_static>")
else()
@ -595,7 +595,7 @@ endif()
if (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libc++")
if (SANITIZER_TEST_CXX_INTREE)
list(APPEND SANITIZER_TEST_CXX_CFLAGS "$<$<TARGET_EXISTS:cxx-headers>:-isystem$<JOIN:$<TARGET_PROPERTY:cxx-headers,INTERFACE_INCLUDE_DIRECTORIES>,$<SEMICOLON>-isystem>>")
list(APPEND SANITIZER_TEST_CXX_CFLAGS "$<$<TARGET_EXISTS:cxx-headers>:$<IF:$<BOOL:${MSVC}>,/imsvc,-isystem>$<JOIN:$<TARGET_PROPERTY:cxx-headers,INTERFACE_INCLUDE_DIRECTORIES>,$<SEMICOLON>$<IF:$<BOOL:${MSVC}>,/imsvc,-isystem>>>")
if (SANITIZER_USE_STATIC_TEST_CXX)
list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:cxx_static>")
else()