From a8572981126e455b99ba813edbc9a88a3269d8b6 Mon Sep 17 00:00:00 2001 From: Thanh Do Date: Fri, 18 Oct 2024 09:43:38 -0700 Subject: [PATCH] Copybara import of the project: -- 58c1fdef8b637b8cdfff4c96a7a01c2962ae344e by Chitoge Kirisaki : Fix linking errors for MSVC COPYBARA_INTEGRATE_REVIEW=https://github.com/google/binexport/pull/142 from chitoge:main 58c1fdef8b637b8cdfff4c96a7a01c2962ae344e PiperOrigin-RevId: 687334496 Change-Id: I47df247c49e70db6ad7284d96f8bdf392d8ab7fe --- cmake/BinExportDeps.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/BinExportDeps.cmake b/cmake/BinExportDeps.cmake index 94d47588..8759c81c 100644 --- a/cmake/BinExportDeps.cmake +++ b/cmake/BinExportDeps.cmake @@ -57,6 +57,10 @@ set(ABSL_CXX_STANDARD ${CMAKE_CXX_STANDARD} CACHE STRING "" FORCE) set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "" FORCE) set(ABSL_USE_EXTERNAL_GOOGLETEST ON CACHE BOOL "" FORCE) set(ABSL_FIND_GOOGLETEST OFF CACHE BOOL "" FORCE) +if(MSVC) + # Link MSVCRT statically for abseil + set(ABSL_MSVC_STATIC_RUNTIME ON CACHE BOOL "" FORCE) +endif() if(BUILD_TESTING AND BINEXPORT_BUILD_TESTING) # Need this for absl::status_matchers to be available set(ABSL_BUILD_TESTING ON CACHE BOOL "" FORCE) @@ -80,6 +84,10 @@ set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(protobuf_INSTALL OFF CACHE BOOL "" FORCE) set(protobuf_WITH_ZLIB OFF CACHE BOOL "" FORCE) +if(MSVC) + # Link MSVCRT statically for protoc + set(protobuf_MSVC_STATIC_RUNTIME ON CACHE BOOL "" FORCE) +endif() FetchContent_MakeAvailable(protobuf) binexport_check_target(protobuf::libprotobuf) binexport_check_target(protobuf::protoc) @@ -147,4 +155,3 @@ if(BINEXPORT_ENABLE_IDAPRO) endif() #set(BUILD_TESTING ${BINEXPORT_SAVE_BUILD_TESTING}) -