Using protobuf in visual studio 2017

689 views
Skip to first unread message

Mathias Waack

unread,
May 4, 2017, 9:31:08 AM5/4/17
to Protocol Buffers
I have build protobuf branch 2.7.0 successfully in Visual Studio 2017 using cmake. Now I am trying to port an existing project, also based on cmake. But cmake is not able to find protobuf. 

Protobuf was checked out from git to c:\protobuf. After that I loaded the CMakeLists.txt into Visual  Studio, set the CMAKE_INSTALL_PREFIX to "c:\\protobuf\\install" and built and installed the project. After that I switched to my other project. It is a linux project, a simple 

find_package(Protobuf REQUIRED)

is enough for linux, in Visual Studio it returns: 

CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
1>   Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
1> Call Stack (most recent call first):

ok, trying to help find_package:

find_package(Protobuf CONFIG REQUIRED PATHS "c:/protobuf/install/" NO_DEFAULT_PATH)
find_package(Protobuf REQUIRED)

returns

CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
1>   Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
1>   (found version "2.7.0")

Hm, it found the right version, but no headers and libs. Both are there, I have checked it. The libs  are static libs. 

I am stuck here. Anyone able to help me? 

Mathias
Reply all
Reply to author
Forward
0 new messages