From 6f2d4a1e01b5d435fec0c001fa1a4908c27b7a03 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 5 Dec 2023 22:20:16 +0200 Subject: [PATCH] libspatialite: add a workaround for NMakeDeps quoting issues https://github.com/conan-io/conan/issues/13603 --- recipes/libspatialite/all/conanfile.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/recipes/libspatialite/all/conanfile.py b/recipes/libspatialite/all/conanfile.py index 3b5b02b67f3120..be19262a8f852c 100644 --- a/recipes/libspatialite/all/conanfile.py +++ b/recipes/libspatialite/all/conanfile.py @@ -120,6 +120,9 @@ def source(self): def generate(self): if is_msvc(self): tc = NMakeToolchain(self) + tc.extra_defines.append("YY_NO_UNISTD_H") + if self.options.shared: + tc.extra_defines.append("DLL_EXPORT") tc.generate() deps = NMakeDeps(self) deps.generate() @@ -194,12 +197,15 @@ def _build_msvc(self): if not self.options.with_minizip: replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_MINIZIP 1", "") + # Workaround for a NMakeDeps define quoting issue: + # https://github.com/conan-io/conan/issues/13603 + replace_in_file(self, os.path.join(self.generators_folder, "conannmakedeps.bat"), + r'/DSQLITE_API#\"__declspec(dllimport)\"', + "/DSQLITE_API#__declspec(dllimport)", strict=False) + target = "spatialite_i.lib" if self.options.shared else "spatialite.lib" - optflags = ["-DYY_NO_UNISTD_H"] - if self.options.shared: - optflags.append("-DDLL_EXPORT") with chdir(self, self.source_folder): - self.run(f"nmake -f makefile.vc {target} OPTFLAGS=\"{' '.join(optflags)}\"") + self.run(f"nmake -f makefile.vc {target}") def _build_autotools(self): # fix MinGW