From fcb222188929a3ba7b26f669a43f3a592821da3b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 14:25:43 +0200 Subject: [PATCH] ncurses: link against naive-tsearch on MSVC --- recipes/ncurses/all/conanfile.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/recipes/ncurses/all/conanfile.py b/recipes/ncurses/all/conanfile.py index 567f6a0f2517f6..8f9887cb0c099c 100644 --- a/recipes/ncurses/all/conanfile.py +++ b/recipes/ncurses/all/conanfile.py @@ -51,6 +51,10 @@ class NCursesConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" + def export_sources(self): export_conandata_patches(self) copy(self, "*.cmake", src=self.recipe_folder, dst=self.export_sources_folder) @@ -81,7 +85,7 @@ def requirements(self): if is_msvc(self): self.requires("getopt-for-visual-studio/20200201") self.requires("dirent/1.24") - if self.options.get_safe("with_extended_colors", False): + if self.options.get_safe("with_extended_colors"): self.requires("naive-tsearch/0.1.1") def validate(self): @@ -159,7 +163,10 @@ def generate(self): if check_min_vs(self, 180, raise_invalid=False): tc.extra_cflags.append("-FS") tc.extra_cxxflags.append("-FS") - if (self.settings.os, self.settings.compiler) == ("Windows", "gcc"): + if self.options.get_safe("with_extended_colors"): + tc.extra_cflags.append(" ".join(f"-I{lib}" for lib in self.dependencies["naive-tsearch"].cpp_info.includedirs)) + tc.extra_ldflags.append(" ".join(f"-l{lib}" for lib in self.dependencies["naive-tsearch"].cpp_info.libs)) + if self._is_mingw: # add libssp (gcc support library) for some missing symbols (e.g. __strcpy_chk) tc.extra_ldflags.extend(["-lmingwex", "-lssp"]) if build: