FileList 0.3.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages Concepts
conanfile.py
Go to the documentation of this file.
1from conan import ConanFile
2from conan.tools.build import check_min_cppstd
3from conan.tools.files import load
4from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
5import os
6import re
7
8required_conan_version = ">=1.50.0"
9
10class FileListRecipe(ConanFile):
11 implements = ["auto_shared_fpic"]
12 name = "file_list"
13
14 def set_version(self):
15 content = load(self, os.path.join(self.recipe_folder, "CMakeLists.txt"))
16 version = re.search("project\‍(FL VERSION (.*) LANGUAGES CXX\‍)", content).group(1)
17 self.version = version.strip()
18
19 # Optional metadata
20 license = "MIT"
21 author = "David Ledger davidledger@live.com.au"
22 url = "https://gitlab.com/seppeon/file_list"
23 homepage = "https://seppeon.gitlab.io/file_list/"
24 description = "A library that helps you list, find and move files."
25 topics = ("filesystem", "c++20", "file listing", "file resolving", "file moving")
26 requires = "nlohmann_json/3.11.2", "catch2/3.4.0"
27 build_policy = "missing"
28
29 # Binary configuration
30 settings = "os", "compiler", "build_type", "arch"
31 options = {
32 "shared": [True, False],
33 "fPIC": [True, False]
34 }
35 default_options = {
36 "shared": False,
37 "fPIC": True
38 }
39
40 # Sources are located in the same place as this recipe, copy them to the recipe
41 exports_sources = "CMakeLists.txt", "readme.md", "LICENSE.txt", "src/*", "cmake/*", "test/*", "include/*", "private/*", "apps/*", "docs/*"
42
43 def config_options(self):
44 if self.settings.os == "Windows":
45 del self.options.fPIC
46
47 def generate(self):
48 tc = CMakeToolchain(self)
49 tc.generate()
50 deps = CMakeDeps(self)
51 deps.generate()
52
53 def layout(self):
54 cmake_layout(self)
55
56 def validate(self):
57 if self.settings.compiler.get_safe("cppstd"):
58 check_min_cppstd(self, "20")
59
60 def build(self):
61 cmake = CMake(self)
62 cmake.configure()
63 cmake.build()
64
65 def package(self):
66 cmake = CMake(self)
67 cmake.install()
68
69 def package_info(self):
70 self.cpp_info.set_property("cmake_file_name", "FL")
71 self.cpp_info.set_property("cmake_target_name", "FL::FL")
72 self.cpp_info.set_property("pkg_config_name", "FL")
73 self.cpp_info.libs = [ "FL" ]