Visual studio 使用cmake在windows上构建protobuf 3.9.4

Visual studio 使用cmake在windows上构建protobuf 3.9.4,visual-studio,cmake,protocol-buffers,Visual Studio,Cmake,Protocol Buffers,我正试图用cmake在windows上构建protobuf 3.9.4,但当我单击“配置”时,我收到一条消息:“链接:致命错误LNK1101:错误的MSPDB140.DLL版本;重新检查本产品的安装” 有人知道这里发生了什么吗 VisualStudio很可能有问题,但我不确定是什么问题 我试着在谷歌上搜索解决方案,但都与我的问题无关 附言。 我正在使用cmake的gui版本。有一个cmake脚本补丁的有用示例,需要使用vcpkg在Visual Studio 2017中构建protobuf 3.4

我正试图用cmake在windows上构建protobuf 3.9.4,但当我单击“配置”时,我收到一条消息:“链接:致命错误LNK1101:错误的MSPDB140.DLL版本;重新检查本产品的安装”

有人知道这里发生了什么吗

VisualStudio很可能有问题,但我不确定是什么问题

我试着在谷歌上搜索解决方案,但都与我的问题无关

附言。
我正在使用cmake的gui版本。

有一个cmake脚本补丁的有用示例,需要使用vcpkg在Visual Studio 2017中构建protobuf 3.4.1

#region PDFsharp - A .NET library for processing PDF
//
// Authors:
//   Stefan Lange
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 7618ba2..d282a60 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -165,8 +165,10 @@ endif (protobuf_UNICODE)

 include(libprotobuf-lite.cmake)
 include(libprotobuf.cmake)
-include(libprotoc.cmake)
-include(protoc.cmake)
+if(protobuf_BUILD_COMPILER)
+  include(libprotoc.cmake)
+  include(protoc.cmake)
+endif()

 if (protobuf_BUILD_TESTS)
   include(tests.cmake)

diff --git a/cmake/install.cmake b/cmake/install.cmake
index 441bf55..20b3aa0 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -1,14 +1,17 @@
 include(GNUInstallDirs)

+set(LIBRARIES_TO_SET_DEST libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+  list(APPEND LIBRARIES_TO_SET_DEST libprotoc)
+endif()
+
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake
                ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake
                ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY)

 foreach(_library
-  libprotobuf-lite
-  libprotobuf
-  libprotoc)
+  ${LIBRARIES_TO_SET_DEST})
   set_property(TARGET ${_library}
     PROPERTY INTERFACE_INCLUDE_DIRECTORIES
     $<BUILD_INTERFACE:${protobuf_source_dir}/src>
@@ -19,8 +22,10 @@ foreach(_library
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
 endforeach()

-install(TARGETS protoc EXPORT protobuf-targets
-  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+if(protobuf_BUILD_COMPILER)
+  install(TARGETS protoc EXPORT protobuf-targets
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+endif()

 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

@@ -101,7 +106,12 @@ configure_file(protobuf-options.cmake
   ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)

 # Allows the build directory to be used as a find directory.
-export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+set(FIND_DIRS libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+  list(APPEND FIND_DIRS libprotoc protoc)
+endif()
+
+export(TARGETS ${FIND_DIRS}
   NAMESPACE protobuf::
   FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
 )
#region PDFsharp-用于处理PDF的.NET库
//
//作者:
//斯特凡·兰格
diff——git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
索引7618ba2..d282a60 100644
---a/cmake/CMakeLists.txt
+++b/cmake/CMakeLists.txt
@@-165,8+165,10@@endif(protobuf_UNICODE)
包括(libprotobuf lite.cmake)
包括(libprotobuf.cmake)
-包括(libprotoc.cmake)
-包括(protoc.cmake)
+if(protobuf_BUILD_编译器)
+包括(libprotoc.cmake)
+包括(protoc.cmake)
+endif()
if(协议构建测试)
包括(tests.cmake)
diff——git a/cmake/install.cmake b/cmake/install.cmake
索引441bf55..20b3aa0 100644
---a/cmake/install.cmake
+++b/cmake/install.cmake
@@ -1,14 +1,17 @@
包括(GNUInstallDirs)
+集合(库\u到\u集合\u目标libprotobuf lite libprotobuf)
+if(protobuf_BUILD_编译器)
+列表(将库添加到集合中)
+endif()
+
配置文件(${CMAKE\u CURRENT\u SOURCE\u DIR}/protobuf.pc.CMAKE
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc@仅限)
配置文件(${CMAKE\u CURRENT\u SOURCE\u DIR}/protobuf-lite.pc.CMAKE
${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc@ONLY)
foreach(_)图书馆
-libprotobuf-lite
-libprotobuf
-libprotoc)
+${LIBRARIES\u TO\u SET\u DEST})
set_属性(目标${u库}
属性接口\u包含\u目录
$
@@-19,8+22,10@@foreach(\u库
存档目标${CMAKE\u INSTALL\u LIBDIR}组件${u library})
endforeach()
-安装(目标protoc导出protobuf目标
-运行时目标${CMAKE\u INSTALL\u BINDIR}组件协议)
+if(protobuf_BUILD_编译器)
+安装(目标protoc导出protobuf目标
+运行时目标${CMAKE\u INSTALL\u BINDIR}组件协议)
+endif()
安装(文件${CMAKE\u CURRENT\u BINARY\u DIR}/protobuf.pc${CMAKE\u CURRENT\u BINARY\u DIR}/protobuf-lite.pc DESTINATION“${CMAKE\u install\u LIBDIR}/pkgconfig”)
@@-101,7+106,12@@configure_文件(protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.CMAKE@ONLY)
#允许将生成目录用作查找目录。
-导出(目标为libprotobuf lite libprotobuf libprotoc protoc
+集合(查找目录libprotobuf lite libprotobuf)
+if(protobuf_BUILD_编译器)
+列表(附加FIND_DIRS libprotoc protoc)
+endif()
+
+导出(目标${FIND_DIRS}
命名空间protobuf::
文件${CMAKE\u INSTALL\u CMAKEDIR}/protobuf-targets.CMAKE
)

获得3.9.4版本最简单的方法可能是升级原始版本。到目前为止,我使用vcpkg构建C/C++端口的经验是积极的。

Visual Studio有问题,很可能是的。这很可能与CMake和protobuf无关。