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)
這些文件可以通過設置環境變量?我該如何使用它們?