From c295c81bf2cb8c5f43ddd99a836030555dbcbbc5 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Wed, 1 Mar 2023 12:18:35 +0300 Subject: [PATCH] [Conan] add validate method to catch incorrect combination of options --- conanfile.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index f93afed96..0054645f7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -204,7 +204,7 @@ class VCMI(ConanFile): self.requires("qt/[~5.15.2]") # use Apple system libraries instead of external ones - if self.options.with_apple_system_libs and not self.options.default_options_of_requirements and is_apple_os(self): + if self.options.with_apple_system_libs and is_apple_os(self): systemLibsOverrides = [ "bzip2/1.0.8", "libiconv/1.17", @@ -223,6 +223,12 @@ class VCMI(ConanFile): if self.options.with_luajit and not str(self.settings.arch).startswith("arm"): self.requires("luajit/[~2.0.5]") + def validate(self): + if self.options.with_apple_system_libs and not is_apple_os(self): + raise ConanInvalidConfiguration("with_apple_system_libs is only for Apple platforms") + if self.options.with_apple_system_libs and self.options.default_options_of_requirements: + raise ConanInvalidConfiguration("with_apple_system_libs and default_options_of_requirements can't be True at the same time") + def generate(self): tc = CMakeToolchain(self) tc.variables["USING_CONAN"] = True