1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-07 08:02:56 +03:00

cmake: automatic exports macro tidy-up (#875)

In a recent CMake update I left the original CMake EXPORTS macro
unchanged (`libssh2_EXPORTS`) for compatibility.

However, that macro was also recently added [1] and not present in an
official release yet, so we might as well just use the new native one
instead (`libssh2_shared_EXPORTS`), defined by CMake automatically.
This way we don't need to define the old macro manually.

CMake forms this macro from the lib's internal name as defined in
`add_library()` by appending `_EXPORTS`. That target name changed from
`libssh2` to `libssh2_shared` after introducing dual shared + static
builds in the recent update.

If we're here, add a new, stable, build-tool agnostic macro with the
same effect, for non-CMake use: `LIBSSH2_EXPORTS`

[1] 1f0fe7443a (2021-10-26)

Follow-up to 4e2580628d
This commit is contained in:
Viktor Szakats
2023-03-24 03:29:46 +01:00
committed by GitHub
parent c7d4844386
commit bd078e12bd
2 changed files with 2 additions and 2 deletions

View File

@@ -100,7 +100,8 @@ extern "C" {
/* Allow alternate API prefix from CFLAGS or calling app */
#ifndef LIBSSH2_API
# ifdef WIN32
# if defined(_WINDLL) || defined(libssh2_EXPORTS)
# if defined(LIBSSH2_EXPORTS) || \
defined(_WINDLL) || defined(libssh2_shared_EXPORTS)
# ifdef LIBSSH2_LIBRARY
# define LIBSSH2_API __declspec(dllexport)
# else