catch2/.conan/test_package/conanfile.py
Devon Adair 62d4aecb8c
Conan v2 (#2805)
* Removed Conan1 build.py file using conan package tools that are no longer supported

* Working conan 1 and 2 build with the test package. 

updated the test_package to be updated to conan 2 and fixed missing cmake. Still need to check that the license file is packaged up and that the packages look identical before the changes

* Removing debug prints and the license check that isn't working yet

* Working license file copied over as it was before

* Migrated the properties of cpp_info to conan 2. Keeping conan 1 support by checking the version of conan

https://docs.conan.io/1/migrating_to_2.0/properties.html

* Revert "Removed Conan1 build.py file using conan package tools that are no longer supported"

This reverts commit a606d1dfe6.

* Need to add a set_version to parse the version from CMakeLists.txt

Adding a package build yaml to ensure conan keeps building on 1 and 2

* Setting lowercase catch2 for pkg_config and cmake_target_name

* Fixing the namespace for conan file cmake_target_name
2024-02-17 16:42:44 +01:00

34 lines
991 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"
def requirements(self):
self.requires(self.tested_reference_str)
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
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'