I have been trying to build Conan packages of my project for a week. I have been reading the documentation but there are many points that I'm still confused about.
There are 4 files that I think are very important:
- conanfile.py
- conanfile.txt
- conan_profile
- settings.yml
What is the purpose of each file? Where should each file be located? Which ones are interchangeable?
I have the following conanfile.py
that generates the Conan package:
from conans import ConanFile, CMake
class mylibConan(ConanFile):
name = "mylib"
version = "1.16.0"
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = "shared=False"
exports_sources = ["*"]
url = ""
license = ""
description = "The mylib HAL library."
def configure(self):
self.options.shared = False
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
libs_build_dir = "lib_mylib/" + str(self.settings.build_type)
api_dir = "modules/mylib/lib/api/"
self.copy(pattern="lib_mylib.lib", dst="lib", src=libs_build_dir)
self.copy(pattern="*", dst="include", src=api_dir)
def package_info(self):
self.cpp_info.includedirs = ['include']
self.cpp_info.libdirs = ['lib']
self.cpp_info.libs = ['mylib']
...and the following conanfile.txt
in my main project that consumes the Conan package:
[requires]
mylib/1.16.0@demo/testing
[generators]
cmake
visual_studio_multi
I need to define the cl
version to be 14.24.28314
so it doesn't conflict with the consuming project.
Where should I define the cl
version?