2017-06-23 15:34:56 +02:00
|
|
|
#!/usr/bin/env python
|
2018-06-19 07:14:46 +02:00
|
|
|
from conans import ConanFile, CMake
|
2017-06-23 15:34:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
class CatchConan(ConanFile):
|
2020-01-25 18:48:59 +01:00
|
|
|
name = "catch2"
|
|
|
|
description = "A modern, C++-native, framework for unit-tests, TDD and BDD"
|
2020-01-20 20:20:59 +01:00
|
|
|
topics = ("conan", "catch2", "unit-test", "tdd", "bdd")
|
2018-06-11 10:48:10 +02:00
|
|
|
url = "https://github.com/catchorg/Catch2"
|
2018-11-16 12:45:07 +01:00
|
|
|
homepage = url
|
|
|
|
license = "BSL-1.0"
|
2020-01-25 18:48:59 +01:00
|
|
|
|
2018-11-16 12:45:07 +01:00
|
|
|
exports = "LICENSE.txt"
|
2020-01-14 19:36:36 +01:00
|
|
|
exports_sources = ("src/*", "CMakeLists.txt", "CMake/*", "extras/*")
|
2020-01-25 18:48:59 +01:00
|
|
|
|
2020-01-14 19:36:36 +01:00
|
|
|
settings = "os", "compiler", "build_type", "arch"
|
2020-01-25 18:48:59 +01:00
|
|
|
|
|
|
|
options = {"with_main": [True, False]}
|
|
|
|
default_options = {"with_main": True}
|
2018-06-19 07:14:46 +02:00
|
|
|
|
2020-01-14 19:36:36 +01:00
|
|
|
def _configure_cmake(self):
|
2018-06-19 07:14:46 +02:00
|
|
|
cmake = CMake(self)
|
|
|
|
cmake.definitions["BUILD_TESTING"] = "OFF"
|
|
|
|
cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF"
|
2018-07-01 16:21:12 +02:00
|
|
|
cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON"
|
2020-01-14 19:36:36 +01:00
|
|
|
cmake.configure(build_folder="build")
|
|
|
|
return cmake
|
|
|
|
|
|
|
|
def build(self):
|
|
|
|
cmake = self._configure_cmake()
|
|
|
|
cmake.build()
|
2018-06-19 07:14:46 +02:00
|
|
|
|
2020-01-14 19:36:36 +01:00
|
|
|
def package(self):
|
2018-06-19 07:14:46 +02:00
|
|
|
self.copy(pattern="LICENSE.txt", dst="licenses")
|
2020-01-14 19:36:36 +01:00
|
|
|
cmake = self._configure_cmake()
|
|
|
|
cmake.install()
|
2017-10-31 15:17:21 +01:00
|
|
|
|
2020-01-25 18:48:59 +01:00
|
|
|
def package_id(self):
|
|
|
|
del self.info.options.with_main
|
|
|
|
|
2020-01-14 19:36:36 +01:00
|
|
|
def package_info(self):
|
2020-01-25 18:48:59 +01:00
|
|
|
self.cpp_info.libs = [
|
|
|
|
'Catch2Main', 'Catch2'] if self.options.with_main else ['Catch2']
|
2020-01-14 19:36:36 +01:00
|
|
|
self.cpp_info.names["cmake_find_package"] = "Catch2"
|
|
|
|
self.cpp_info.names["cmake_find_package_multi"] = "Catch2"
|