Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch2: add console_width parameter #14475

Merged
merged 7 commits into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions recipes/catch2/3.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ class Catch2Conan(ConanFile):
"fPIC": [True, False],
"with_prefix": [True, False],
"default_reporter": [None, "ANY"],
"console_width": [None, "ANY"],
}
default_options = {
"shared": False,
"fPIC": True,
"with_prefix": False,
"default_reporter": None,
"console_width": "80",
}

@property
def _min_cppstd(self):
return "14"

@property
def _min_console_width(self):
# Catch2 doesn't build if less than this value
return 46

@property
def _compilers_minimum_version(self):
return {
Expand Down Expand Up @@ -72,6 +79,15 @@ def validate(self):
f"{self.ref} requires C++{self._min_cppstd}, which your compiler doesn't support",
)

try:
if int(self.options.console_width) < self._min_console_width:
raise ConanInvalidConfiguration(
f"option 'console_width' must be >= {self._min_console_width}, "
f"got {self.options.console_width}. Contributions welcome if this should work!")
except ValueError as e:
raise ConanInvalidConfiguration(f"option 'console_width' must be an integer, "
f"got '{self.options.console_width}'") from e

def source(self):
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True)

Expand All @@ -82,6 +98,7 @@ def generate(self):
tc.cache_variables["CATCH_INSTALL_EXTRAS"] = True
tc.cache_variables["CATCH_DEVELOPMENT_BUILD"] = False
tc.variables["CATCH_CONFIG_PREFIX_ALL"] = self.options.with_prefix
tc.variables["CATCH_CONFIG_CONSOLE_WIDTH"] = self.options.console_width
if self.options.default_reporter:
tc.variables["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str
tc.generate()
Expand Down