Skip to content

Commit 13c1bd7

Browse files
authored
adding build() in conanfile.py (#190)
1 parent 736a3ba commit 13c1bd7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tutorial/consuming_packages/conanfile_py/ci_test_example.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def run_example(output_folder=""):
3535

3636
assert "ZLIB VERSION: 1.3.1" in cmd_out
3737

38+
# Make sure ``conan build`` works in every platform
39+
if os.path.exists("build"):
40+
shutil.rmtree("build")
41+
run("conan build .")
42+
3843

3944
print("- Understanding the flexibility of using conanfile.py vs conanfile.txt -")
4045

tutorial/consuming_packages/conanfile_py/complete_conanfile.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
from conan import ConanFile
5+
from conan.tools.cmake import CMake
56

67

78
class CompressorRecipe(ConanFile):
@@ -30,3 +31,7 @@ def layout(self):
3031
self.folders.generators = os.path.join("build", str(self.settings.build_type), "generators")
3132
self.folders.build = os.path.join("build", str(self.settings.build_type))
3233

34+
def build(self):
35+
cmake = CMake(self)
36+
cmake.configure()
37+
cmake.build()

0 commit comments

Comments
 (0)