0

I need to compile three packages from the same code, but the includes(same name xyz.h) in the cmake should get picked from different location for each of the package. As I am new to c++ and conan, please give pointers.

newbie
  • 35
  • 6
  • Do you want to provide 3 binary packages using 1 single code, is that correct? Each package will contain only different headers, what about libraries? Is it a single project, or are there sub projects? – uilianries Aug 17 '20 at 12:30
  • same project, same libraries used. – newbie Aug 17 '20 at 13:53
  • it's not clear enough, why do you need different headers for the same library? Please, provide a detailed description, your case is not clear. Details are important to understand what's the best approach to solve your problem. – uilianries Aug 17 '20 at 15:33

1 Answers1

1

You should be implementing the logic you want in your package() method:

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")
    ...

This assumes you have different win and nix folders in your layout when you build the package.

Then you do the conan create as many times as necessary:

$ 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

Every package will end with different headers in the final include folder

drodri
  • 5,157
  • 15
  • 21