2017-11-03 26 views
1

私はcmakeを使ってwindows上にprotobuf 3.9.4をビルドしようとしていますが、 'configure'をクリックすると 'LINK:致命的なエラーLNK1101:間違ったMSPDB140'というメッセージが表示されます。 DLLのバージョン。この製品の再インストールを確認してください。ビルドprotobuf 3.9.4とcmakeとのウィンドウ

ここで何が起こっているのか誰かが知りませんか?

Visual Studioで何か問題が起きている可能性がありますが、わかりません。

私は解決策を見つけようとしましたが、私の問題に関連するものはありません。

P.S. 私はguakeバージョンのcmakeを使用しています。

+0

「Visual Studioで何か問題が起きている可能性が高い」 - はい。そしておそらくこれは** CMakeとprotobufの両方に無関係です**。 – Tsyvarev

答えて

2

vcpkgを使ってVisual Studio 2017でprotobuf 3.4.1をビルドするのに必要なCMakeスクリプトのパッチの有用な例があります。

#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 
) 

おそらく3.9.4建物を取得する最も簡単な方法は、元protobuf 3.4.1 vcpkg portをアップグレードすることです。 vcpkgを使用してC/C++ポートを構築した経験はこれまでのところ肯定的なものでした。

関連する問題