Skip to content

cmake: drop libssh CONFIG-style detection - #14614

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:cm-libssh-fixups
Closed

vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:cm-libssh-fixups

Conversation

@vszakats

@vszakats vszakats commented Aug 20, 2024 •

Copy link
Copy Markdown
Member

Drop find_package(libssh CONFIG) detection method in favour of
the Find module that supports both pkg-config, and CMake-native
(since #14555) detection.

This aligns libssh detection with other dependencies. It makes the
build honor custom configuration via LIBSSH_INCLUDE_DIR,
LIBSSH_LIBRARY.

Also enable libssh in a GHA/macos cmake job for build coverage.

Fixing:

Follow-up to 422696f #14555


w/o whitespace: https://github.com/curl/curl/pull/14614/files?w=1

@vszakats

vszakats commented Aug 20, 2024 •

Copy link
Copy Markdown
Member Author

Original detection snippet via a158a09 #5372

find_package(libssh CONFIG)
if(libssh_FOUND)
  message(STATUS "Found libssh ${libssh_VERSION}")
  # Use imported target for include and library paths.
  list(APPEND CURL_LIBS ssh)
  set(USE_LIBSSH ON)
  set(HAVE_LIBSSH_LIBSSH_H 1)
endif()

@github-actions github-actions Bot added the CI Continuous Integration label Aug 20, 2024
@vszakats vszakats changed the title cmake: try dropping libssh hack 1 cmake: drop libssh CONFIG-style detection Aug 20, 2024
vszakats added a commit that referenced this pull request Aug 20, 2024
For libssh, it fixes a "unity" build issue where libssh deprecation
warnings were not suppressed before this patch, because the suppression
macro was only set before just one of the two `libssh.h` includes.
If the other was compiled first in unity mode, the warnings appeared.

Seen in local curl-for-win build (`CW_CONFIG=test-x64-libssh-quictls`)
with libssh 0.11.0. (Also in a GHA/macos cmake job upcoming in #14614)

Use this opportunity to drop duplicate SSH header includes from the SSH
modules. It's enough to include them via the common `ssh.h` header.

Closes #14612
vszakats added a commit to vszakats/curl that referenced this pull request Aug 20, 2024
```
/Users/runner/work/curl/curl/lib/version.c: In function 'curl_version_info':
/Users/runner/work/curl/curl/lib/version.c:584:15: error: declaration of 'ssh_buffer' shadows a global declaration [-Werror=shadow]
  584 |   static char ssh_buffer[80];
      |               ^~~~~~~~~~
In file included from /Users/runner/work/curl/curl/lib/vssh/ssh.h:35,
                 from /Users/runner/work/curl/curl/lib/urldata.h:185,
                 from /Users/runner/work/curl/curl/lib/altsvc.c:32,
                 from /Users/runner/work/curl/curl/bld/lib/CMakeFiles/libcurl_shared.dir/Unity/unity_0_c.c:4:
/opt/homebrew/include/libssh/libssh.h:99:35: note: shadowed declaration is here
   99 | typedef struct ssh_buffer_struct* ssh_buffer;
      |                                   ^~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/10477958747/job/29020250670#step:9:48

Tested via curl#14614
vszakats added a commit that referenced this pull request Aug 20, 2024
```
/Users/runner/work/curl/curl/lib/version.c: In function 'curl_version_info':
/Users/runner/work/curl/curl/lib/version.c:584:15: error: declaration of 'ssh_buffer' shadows a global declaration [-Werror=shadow]
  584 |   static char ssh_buffer[80];
      |               ^~~~~~~~~~
In file included from /Users/runner/work/curl/curl/lib/vssh/ssh.h:35,
                 from /Users/runner/work/curl/curl/lib/urldata.h:185,
                 from /Users/runner/work/curl/curl/lib/altsvc.c:32,
                 from /Users/runner/work/curl/curl/bld/lib/CMakeFiles/libcurl_shared.dir/Unity/unity_0_c.c:4:
/opt/homebrew/include/libssh/libssh.h:99:35: note: shadowed declaration is here
   99 | typedef struct ssh_buffer_struct* ssh_buffer;
      |                                   ^~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/10477958747/job/29020250670#step:9:48

Tested via #14614

Closes #14617
vszakats added a commit to curl/curl-for-win that referenced this pull request Aug 21, 2024
@vszakats vszakats closed this in 576b39b Aug 21, 2024
@vszakats
vszakats deleted the cm-libssh-fixups branch August 21, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI Continuous Integration cmake SCP/SFTP

Development

Successfully merging this pull request may close these issues.

1 participant