mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
cmake: Avoid setting compiler flags directly
Calling set_target_properties directly overrides previously set flags,
so replace them with target_compile_definitions and target_link_options.
Signed-off-by: DDoSolitary <DDoSolitary@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 0679945383)
This commit is contained in:
@@ -331,7 +331,7 @@ target_link_libraries(ssh
|
|||||||
PRIVATE ${LIBSSH_LINK_LIBRARIES})
|
PRIVATE ${LIBSSH_LINK_LIBRARIES})
|
||||||
|
|
||||||
if (WIN32 AND NOT BUILD_SHARED_LIBS)
|
if (WIN32 AND NOT BUILD_SHARED_LIBS)
|
||||||
set_target_properties(ssh PROPERTIES COMPILE_FLAGS "-DLIBSSH_STATIC")
|
target_compile_definitions(ssh PUBLIC "LIBSSH_STATIC")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_library(ssh::ssh ALIAS ssh)
|
add_library(ssh::ssh ALIAS ssh)
|
||||||
@@ -342,9 +342,7 @@ if (WITH_SYMBOL_VERSIONING AND HAVE_LD_VERSION_SCRIPT)
|
|||||||
set(MAP_PATH "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_dev.map")
|
set(MAP_PATH "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_dev.map")
|
||||||
endif (ABIMAP_FOUND)
|
endif (ABIMAP_FOUND)
|
||||||
|
|
||||||
set_target_properties(ssh
|
target_link_libraries(ssh PRIVATE "-Wl,--version-script,\"${MAP_PATH}\"")
|
||||||
PROPERTIES LINK_FLAGS
|
|
||||||
"-Wl,--version-script,\"${MAP_PATH}\"")
|
|
||||||
endif (WITH_SYMBOL_VERSIONING AND HAVE_LD_VERSION_SCRIPT)
|
endif (WITH_SYMBOL_VERSIONING AND HAVE_LD_VERSION_SCRIPT)
|
||||||
|
|
||||||
set_target_properties(ssh
|
set_target_properties(ssh
|
||||||
@@ -358,12 +356,12 @@ set_target_properties(ssh
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_VISIBILITY_HIDDEN)
|
if (WITH_VISIBILITY_HIDDEN)
|
||||||
set_target_properties(ssh PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
|
set_target_properties(ssh PROPERTIES C_VISIBILITY_PRESET hidden)
|
||||||
endif (WITH_VISIBILITY_HIDDEN)
|
endif (WITH_VISIBILITY_HIDDEN)
|
||||||
|
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
set_target_properties(ssh PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup")
|
target_link_libraries(ssh PRIVATE "-Wl,--enable-stdcall-fixup")
|
||||||
set_target_properties(ssh PROPERTIES COMPILE_FLAGS "-D_POSIX_SOURCE")
|
target_compile_definitions(ssh PRIVATE "_POSIX_SOURCE")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
@@ -412,12 +410,7 @@ if (BUILD_STATIC_LIB)
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set_target_properties(
|
target_compile_definitions(ssh-static PUBLIC "LIBSSH_STATIC")
|
||||||
ssh-static
|
|
||||||
PROPERTIES
|
|
||||||
COMPILE_FLAGS
|
|
||||||
"-DLIBSSH_STATIC"
|
|
||||||
)
|
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
endif (BUILD_STATIC_LIB)
|
endif (BUILD_STATIC_LIB)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user