From 5d26b0967d270b3f6509cbed1fe636a3e34fa428 Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Wed, 14 Sep 2022 09:40:45 +0000 Subject: [PATCH] Libssh-0.10.4 cannot be compiled anymore on CYGWIN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 8cf9c816 "Do not force GNU_SOURCE during build to fix #141" has broken support for CYGWIN. The build hangs with this error message: libssh-0.10.4/src/config.c: In function ‘local_parse_glob’: libssh-0.10.4/src/config.c:252:25: error: ‘GLOB_TILDE’ undeclared (first use in this function) 252 | rt = glob(fileglob, GLOB_TILDE, NULL, &globbuf); | ^~~~~~~~~~ I think that it would be better to re-add it, by using target_compile_definitions() rather than target_compile_options(), which is more appropriate in my opinion. Signed-off-by: Carlo Bramini carlo_bramini@users.sourceforge.net Reviewed-by: Jakub Jelen (cherry picked from commit 37deed27d66ba342e7e8c0a993bfe519f3967337) --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c090fef7..15c778e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -348,6 +348,9 @@ endif (WITH_SYMBOL_VERSIONING AND HAVE_LD_VERSION_SCRIPT AND ABIMAP_FOUND) # This gets built as a static library, if -DBUILD_SHARED_LIBS=OFF is passed to # cmake. add_library(ssh ${libssh_SRCS}) +if (CYGWIN) + target_compile_definitions(ssh PRIVATE _GNU_SOURCE) +endif () target_include_directories(ssh PUBLIC $ @@ -404,6 +407,9 @@ install(EXPORT libssh-config if (BUILD_STATIC_LIB) add_library(ssh-static STATIC ${libssh_SRCS}) + if (CYGWIN) + target_compile_definitions(ssh-static PRIVATE _GNU_SOURCE) + endif () target_include_directories(ssh-static PUBLIC