2018-11-16 12:45:07 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
2024-02-17 16:42:44 +01:00
|
|
|
from conan import ConanFile
|
|
|
|
from conan.tools.cmake import CMake, cmake_layout
|
|
|
|
from conan.tools.build import can_run
|
2018-11-16 12:45:07 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
class TestPackageConan(ConanFile):
|
|
|
|
settings = "os", "compiler", "build_type", "arch"
|
2024-02-17 16:42:44 +01:00
|
|
|
generators = "CMakeToolchain", "CMakeDeps"
|
|
|
|
|
|
|
|
def requirements(self):
|
|
|
|
self.requires(self.tested_reference_str)
|
|
|
|
|
|
|
|
def layout(self):
|
|
|
|
cmake_layout(self)
|
2018-11-16 12:45:07 +01:00
|
|
|
|
|
|
|
def build(self):
|
|
|
|
cmake = CMake(self)
|
|
|
|
cmake.configure()
|
|
|
|
cmake.build()
|
|
|
|
|
|
|
|
def test(self):
|
2024-02-17 16:42:44 +01:00
|
|
|
if can_run(self):
|
|
|
|
cmd = os.path.join(self.cpp.build.bindir, "test_package")
|
|
|
|
self.run(cmd, env="conanrun")
|
|
|
|
|
|
|
|
# If we are on conan 2 we can check the license info is populated
|
|
|
|
if hasattr(self, 'dependencies'):
|
|
|
|
catch2 = self.dependencies["catch2"]
|
|
|
|
assert os.path.exists(f'{catch2.package_folder}/licenses/LICENSE.txt')
|
|
|
|
assert catch2.license == 'BSL-1.0'
|