-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
46 lines (36 loc) · 1.43 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from conans import ConanFile, CMake, tools
import os
class SemVer(ConanFile):
name = "SemVer"
description = "C++ library and command line tool to work with Semantic Versioning"
author = "Gyula Gubacsi <[email protected]>"
license = "General Public License 2.0"
generators = "cmake_find_package"
settings = "os", "arch", "compiler", "build_type"
build_requires = "catch2/[^2.13.0]"
options = {
"shared": [True, False],
"debug_info": [True, False]
}
default_options = {"shared": True, "debug_info": False}
exports_sources = "CMakeLists.txt", "include/*", "src/*", "SemVerConfig.cmake"
def configure(self):
if self.settings.build_type != "Release":
self.options.debug_info = False
def _configure_cmake(self):
modified_build_type = "RelWithDebInfo" \
if self.options.debug_info else self.settings.build_type
cmake = CMake(self, build_type=modified_build_type)
cmake.definitions["CMAKE_PROJECT_INCLUDE"] = \
os.path.join(self.build_folder, "conan_paths.cmake")
cmake.configure()
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.cxxflags.append("-std=c++11")