2
我下面从说明:如何在Windows上使用cmake构建Google protobuf环境?
https://github.com/google/protobuf/tree/master/cmake
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=../../../../install/protobuf ../..
nmake install
在我的程序的CMakeLists.txt我使用:
find_package(Protobuf REQUIRED)
但它告诉我:
-- Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
我认为我应该设置设置环境变量。
有没有一种有效的方法来做到这一点?
在protobuf-master/cmake/install.cmake
我可以看到这一点:
configure_file(protobuf-config.cmake.in
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY)
configure_file(protobuf-config-version.cmake.in
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
configure_file(protobuf-module.cmake.in
${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY)
configure_file(protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
这些文件可以通过设置环境变量?我该如何使用它们?