forked from catchorg/Catch2
Add support for Components
This commit is contained in:
committed by
Martin Hořeňovský
parent
67a9561fb5
commit
3a15433d52
20
conanfile.py
20
conanfile.py
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from conans import ConanFile, CMake, tools
|
||||
|
||||
|
||||
class CatchConan(ConanFile):
|
||||
name = "catch2"
|
||||
description = "A modern, C++-native, framework for unit-tests, TDD and BDD"
|
||||
@@ -15,9 +14,6 @@ class CatchConan(ConanFile):
|
||||
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
|
||||
options = {"with_main": [True, False]}
|
||||
default_options = {"with_main": True}
|
||||
|
||||
generators = "cmake"
|
||||
|
||||
def _configure_cmake(self):
|
||||
@@ -45,11 +41,17 @@ conan_basic_setup()'''.format(line_to_replace, self.install_folder.replace("\\",
|
||||
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'] if self.options.with_main else ['Catch2']
|
||||
self.cpp_info.names["cmake_find_package"] = "Catch2"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "Catch2"
|
||||
# Catch2
|
||||
self.cpp_info.components["catch2base"].names["cmake_find_package"] = "Catch2"
|
||||
self.cpp_info.components["catch2base"].names["cmake_find_package_multi"] = "Catch2"
|
||||
self.cpp_info.components["catch2base"].names["pkg_config"] = "Catch2"
|
||||
self.cpp_info.components["catch2base"].libs = ["Catch2"]
|
||||
# Catch2WithMain
|
||||
self.cpp_info.components["catch2main"].names["cmake_find_package"] = "Catch2WithMain"
|
||||
self.cpp_info.components["catch2main"].names["cmake_find_package_multi"] = "Catch2WithMain"
|
||||
self.cpp_info.components["catch2main"].names["pkg_config"] = "Catch2WithMain"
|
||||
self.cpp_info.components["catch2main"].libs = ["Catch2Main"]
|
||||
self.cpp_info.components["catch2main"].requires = ["catch2base"]
|
||||
|
Reference in New Issue
Block a user