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 to4e2580628d
This commit is contained in:
@@ -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
|
||||
|
@@ -396,7 +396,6 @@ if(BUILD_SHARED_LIBS)
|
||||
add_library(libssh2_shared SHARED ${SOURCES})
|
||||
if(WIN32)
|
||||
set_property(TARGET libssh2_shared APPEND PROPERTY SOURCES ${PROJECT_SOURCE_DIR}/win32/libssh2.rc)
|
||||
target_compile_definitions(libssh2_shared PRIVATE libssh2_EXPORTS)
|
||||
endif()
|
||||
target_compile_definitions(libssh2_shared PRIVATE ${PRIVATE_COMPILE_DEFINITIONS} ${libssh2_DEFINITIONS})
|
||||
target_link_libraries(libssh2_shared PRIVATE ${LIBRARIES})
|
||||
|
Reference in New Issue
Block a user