Skip to content

Commit

Permalink
ncurses: link against naive-tsearch on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 2, 2023
1 parent c9843e8 commit fcb2221
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions recipes/ncurses/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fcb2221

Please sign in to comment.