From 06fc9b0a09506e2bfa56d13a4f9f02d4fbcd73bf Mon Sep 17 00:00:00 2001 From: Chris McGee <87777443+cmcgee1024@users.noreply.github.com> Date: Tue, 11 Feb 2025 08:39:38 -0500 Subject: [PATCH] Add workaround for missing multi-threaded dll support on windows clang/ASM (#325) When building using CMake with Windows, there is an error regarding missing MultithreadedDLL support. Work around this by setting the MSVC_RUNTIME_LIBRARY on that platform to a supported option. ### Checklist - [X] I've run tests to see all new and existing tests pass - [X] I've followed the code style of the rest of the project - [X] I've read the [Contribution Guidelines](CONTRIBUTING.md) - [X] I've updated the documentation if necessary #### If you've made changes to `gyb` files - [X] I've run `.script/generate_boilerplate_files_with_gyb` and included updated generated files in a commit of this pull request ### Motivation: I'm trying to build swift-crypto on Windows with CMake. ### Modifications: I've modified the CMakelists.txt such that the clang can compile the assembly files on Windows. ### Result: Hopefully, Windows builds of swift-crypto are working. --- Sources/CCryptoBoringSSL/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/CCryptoBoringSSL/CMakeLists.txt b/Sources/CCryptoBoringSSL/CMakeLists.txt index 9813f45c..84dc11d4 100644 --- a/Sources/CCryptoBoringSSL/CMakeLists.txt +++ b/Sources/CCryptoBoringSSL/CMakeLists.txt @@ -346,6 +346,8 @@ target_link_libraries(CCryptoBoringSSL PUBLIC $<$>:Foundation> SwiftASN1) set_target_properties(CCryptoBoringSSL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_Swift_MODULE_DIRECTORY}") + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_Swift_MODULE_DIRECTORY}" + // Workaround for missing MultiThreadedDLL for this ASM compiler on Windows + $<$:MSVC_RUNTIME_LIBRARY "MultiThreaded">) set_property(GLOBAL APPEND PROPERTY SWIFT_CRYPTO_EXPORTS CCryptoBoringSSL)