柯南... [已关闭]

问题描述

我需要从相同的代码编译三个软件包,但是对于每个软件包,cmake中的includes(同名xyz.h)应该从不同的位置中选取。 由于我是c ++和conan的新手,所以请提供指针。

解决方法

您应该在package()方法中实现所需的逻辑:

def package(self):
    # for example,headers are different based on OS
    if self.settings.os == "Windows":
       self.copy("*.h",src="win",dst="include")
    elif self.settings.os == "Linux":
       self.copy("*.h,src="nix",dst="include")
    ...

这假设您在构建软件包时在布局中使用了不同的winnix 文件夹

然后根据需要多次执行conan create

$ conan create . user/channel -s os=Windows  # default if you are in a Win machine
# or
$ conan create . user/channel -s os=Linux # default if you are in a Linux machin

每个包在最终的 include 文件夹中都以不同的标题结尾