diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 35c04f1..9cff048 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -36,11 +36,21 @@ target_link_libraries(llvmshims PRIVATE llvmc) # The Ubuntu GitHub runner demands this option: /usr/bin/ld.gold: error: # lib/libllvmshims.a(shim.cc.o): requires dynamic R_X86_64_PC32 reloc against # '_ZN4llvm17OptimizationLevel2O0E' which may overflow at runtime; recompile with -fPIC. We don't -# use -fPIC directly because it clang on Windows rejects it. +# use -fPIC directly because clang on Windows rejects it. set_target_properties(llvmshims PROPERTIES POSITION_INDEPENDENT_CODE True) +if(WIN32) + # According to compnerd, “a Microsoft update requires a newer clang + # than what swift ships. That’s a second chance that they pushed + # that breaks after working around this. The best option is to use a + # 6.0 pre release.” We don't want to impose that on downstream + # clients, so we use this workaround, which isn't compatible with + # Swift/C++ interop. + target_compile_definitions(llvmshims PRIVATE _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) +endif() + # # The Swift module our clients depend on. #