libgit2 - 什么是正确的安装前缀?

时间:2014-06-28 07:18:24

标签: libgit2

我按照其README.md文件中的说明执行libgit2的安装说明。

指定为"安装前缀"?

的正确目录是什么

以下是README.md的相关摘录:

The `libgit2` library is built using [CMake](<http://www.cmake.org>) (version 2.6 or newer) on all platforms.

On most systems you can build the library using the following commands

        $ mkdir build && cd build
        $ cmake ..
        $ cmake --build .

Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace.

To install the library you can specify the install prefix by setting:

        $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix
        $ cmake --build . --target install

1 个答案:

答案 0 :(得分:2)

您可以选择自己喜欢的目录。您只需要确保您对该目录具有写权限。除此之外,当你想针对你的libgit2构建构建另一个程序时,你必须指示它的构建系统在你安装libgit2的文件夹中查找头文件和库文件。类似地,如果您想使用构建的共享libgit2-library运行另一个程序,则必须将libgit2安装的相应文件夹添加到操作系统的相应搜索路径中(例如,在Linux的情况下,您可以设置环境变量LD_LIBRARY_PATH) )。如果未明确指定安装目录,我假设默认值为/usr/usr/local。在这种情况下,您可能不需要使用libgit2构建或运行其他程序的其他配置,因为这些路径通常已包含在相应的设置中。