mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Visual Studio's compiler does not accept `-Werror=switch`. Use the equivalent `-we4062` option instead. Avoid using the `--` separate that clang uses to identify that the options that follow are files and not options on the Visual Studio compiler to reduce the unnecessary spew when building on Windows.
20 lines
1.0 KiB
CMake
20 lines
1.0 KiB
CMake
|
|
# clang-cl interprets paths starting with /U as macro undefines, so we need to
|
|
# put a -- before the input file path to force it to be treated as a path.
|
|
if(NOT MSVC AND "${CMAKE_SIMULATE_ID}" STREQUAL "MSVC")
|
|
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
|
|
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}")
|
|
endif()
|
|
|
|
# NOTE(compnerd) incremental linking is known to cause corruption in the
|
|
# protocol conformance tables. Avoid using incremental links with Visual
|
|
# Studio.
|
|
foreach(TYPE EXE SHARED MODULE)
|
|
foreach(BUILD DEBUG RELWITHDEBINFO)
|
|
string(REPLACE "/INCREMENTAL:YES" "" CMAKE_${TYPE}_LINKER_FLAGS_${BUILD} "${CMAKE_${TYPE}_LINKER_FLAGS_${BUILD}}")
|
|
string(REPLACE "/INCREMENTAL" "" CMAKE_${TYPE}_LINKER_FLAGS_${BUILD} "${CMAKE_${TYPE}_LINKER_FLAGS_${BUILD}}")
|
|
set(CMAKE_${TYPE}_LINKER_FLAGS_${BUILD} ${CMAKE_${TYPE}_LINKER_FLAGS_${BUILD}} CACHE STRING "Flags used by the linker during builds." FORCE)
|
|
endforeach()
|
|
endforeach()
|
|
|