[conan] Fix the Conan package for multiple static library use

This commit is contained in:
Alexandr Timofeev
2020-01-25 20:48:59 +03:00
committed by Martin Hořeňovský
parent 2e1ce37faa
commit 49e000b505
4 changed files with 26 additions and 10 deletions

View File

@ -3,16 +3,20 @@ from conans import ConanFile, CMake
class CatchConan(ConanFile):
name = "Catch2"
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
name = "catch2"
description = "A modern, C++-native, framework for unit-tests, TDD and BDD"
topics = ("conan", "catch2", "unit-test", "tdd", "bdd")
url = "https://github.com/catchorg/Catch2"
homepage = url
license = "BSL-1.0"
exports = "LICENSE.txt"
exports_sources = ("src/*", "CMakeLists.txt", "CMake/*", "extras/*")
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
options = {"with_main": [True, False]}
default_options = {"with_main": True}
def _configure_cmake(self):
cmake = CMake(self)
@ -31,7 +35,11 @@ class CatchConan(ConanFile):
cmake = self._configure_cmake()
cmake.install()
def package_id(self):
del self.info.options.with_main
def package_info(self):
self.cpp_info.libs = ['Catch2Main', 'Catch2']
self.cpp_info.libs = [
'Catch2Main', 'Catch2'] if self.options.with_main else ['Catch2']
self.cpp_info.names["cmake_find_package"] = "Catch2"
self.cpp_info.names["cmake_find_package_multi"] = "Catch2"