Conan——C++包管理工具——使用踩坑记录

Conan——C++包管理工具——使用踩坑记录

使用conan所遇到的大部分问题都可以在conan官方文档中找到答案,

参考官方文档地址:

https://docs.conan.io/en/latest/

虽然大多数情况下,答案不是那么显然。

不过也正是如此,本文把那些可能有点绕的问题的解决办法和原理,尽可能详细的记录下来,

以便后人遇到相同问题时能节省一点定位的时间。

创建一个包的最简步骤

1. conan new 生成一个conanfile.py

2. 编辑conanfile.py

一般的,代码的版本控制不在conan中进行,也不推荐这么做,你有更好的选择:git

from conans import ConanFile, CMake, tools


class BgyArTopicConan(ConanFile):
    name = "bgy_ar_topic"
    version = "v1.0.0"
    ........some informations........
    settings = "os", "compiler", "build_type", "arch"
    requires = ["myjson/v1.0.0@ar/stable"]

    def source(self):
        self.run("git clone git@10.8.202.206:agricultural_robot/ros/common/bgy_ar_topic.git")
        # This small hack might be useful to guarantee proper /MT /MD linkage
        # in MSVC if the packaged project doesn't have variables to set it
        # properly
        tools.replace_in_file("bgy_ar_topic/CMakeLists.txt", "project(bgy_ar_topic)",
                              '''project(bgy_ar_topic)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_ba
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值