-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconanfile.py
More file actions
35 lines (28 loc) · 954 Bytes
/
conanfile.py
File metadata and controls
35 lines (28 loc) · 954 Bytes
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
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMakeToolchain
class ExampleRecipe(ConanFile):
name = "cmake-project"
version = "1.1.1"
description = "C/C++ 项目的 CMake 模板。"
languages = "C++"
author = "DavidingPlus"
homepage = "https://github.com/DavidingPlus/cmake-project-template"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
options = {
"with_gtest": [True, False]
}
default_options = {
"with_gtest": True
}
def requirements(self):
if self.options.with_gtest:
self.requires("gtest/1.12.1")
def layout(self):
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.presets_prefix = "cmake-project"
tc.cache_variables["PACKAGE_VERSION"] = self.version
tc.cache_variables["with_gtest"] = self.options.with_gtest
tc.generate()