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>
Этот коммит содержится в:
родитель
b90cc79cbe
Коммит
0679945383
@ -354,7 +354,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)
|
||||||
@ -365,9 +365,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
|
||||||
@ -381,12 +379,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 ()
|
||||||
|
|
||||||
|
|
||||||
@ -435,12 +433,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)
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user