Conan knows something

Conan is a C++ code library dependency management tool, open source, c/s mode.

Some are similar to pip's management of the python library. If you need to install the library in python, you can use pip install xxxx, or create a new requirements.txt, and write all the dependent libraries needed in the python program in requirements.txt.

Then use pip install -r requirements.txt to install the dependencies uniformly.

 

Conan is to create a conanfile.txt file and declare the dependent library of the C++ project.

 

conan install

pip install conan

conan for local use

1. Create conanfile.txt

[requires]
 proco/1.9.4
 

[generators]
 cmake

[requires]

Declare the specific dependent projects and versions.

[generators]

Declare the make method used by the project. For example, if the project uses cmake, after declaring cmake in the generator part, execute conan install, conan will download the dependency package and generate a .cmake file. Then refer to this .cmake file in the CMakeLists.txt of the project itself to use the conan dependency package in the project compilation.

2. Modify CMakeLists.txt

cmake_minimum_required(VERSION 2.8.12)
 project(MD5Encrypter)

 add_definitions("-std=c++11")

 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
 conan_basic_setup()

 add_executable(md5 md5.cpp)
 target_link_libraries(md5 ${CONAN_LIBS})

Official: https://docs.conan.io/en/latest/reference/commands/consumer/install.html

Guess you like

Origin blog.csdn.net/ynshi57/article/details/114436931