如何使用cmake在windows上编译libgit2?

时间:2015-10-01 00:03:41

标签: windows cmake libgit2

我正在尝试编译libgit2并按照https://libgit2.github.com/docs/guides/build-and-link/上的说明进行操作,但到目前为止锁定了。

有人可以告诉我该怎么做吗?

以下是我的命令行的结果:

-- Building for: Visual Studio 12 2013
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- zlib was not found; using bundled 3rd-party sources.
-- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
CMake Error at d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
  d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  d:/cmake/share/cmake-3.3/Modules/FindPythonInterp.cmake:162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:594 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeOutput.log".
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeError.log".

谢谢,

2 个答案:

答案 0 :(得分:2)

libgit2使用python(适用于该语言的第2版和第3版)来构建测试。你可以安装python或者让CMake不要构建测试。

IIRC CMake会在你的路径中寻找一些你不一定需要python的标准位置,尽管它没有受到伤害。

如果您不想构建测试,可以传递-DBUILD_CLAR=OFF,这样就不用费心去寻找python了。

答案 1 :(得分:0)

从Paython.org下载Python并安装它(即d:\ python)。然后打开VS命令行并键入PATH D:\Python\Python35-32;d:\cmake\bin;%PATH%

现在已全部设定,转到build文件夹cmake ..然后cmake --build .

相关问题