Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link CMAKE_DL_LIBS when necessary #2104

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/mavsdk_server/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ foreach(plugin ${COMPONENTS_LIST})
)
endforeach()


set_target_properties(mavsdk_server
PROPERTIES COMPILE_FLAGS ${warnings}
VERSION ${MAVSDK_VERSION_STRING}
SOVERSION ${MAVSDK_SOVERSION_STRING}
)

target_link_libraries(mavsdk_server PRIVATE ${CMAKE_DL_LIBS})

if(BUILD_STATIC_MAVSDK_SERVER AND ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
target_link_libraries(mavsdk_server PRIVATE atomic.a)
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "(armv6|armv7)")
Expand All @@ -82,6 +83,7 @@ if(NOT IOS AND NOT ANDROID)
target_link_libraries(mavsdk_server_bin PRIVATE
mavsdk_server
mavsdk
${CMAKE_DL_LIBS}
)

if (BUILD_STATIC_MAVSDK_SERVER)
Expand All @@ -91,10 +93,6 @@ if(NOT IOS AND NOT ANDROID)
set_target_properties(mavsdk_server_bin PROPERTIES LINK_SEARCH_END_STATIC ON)
endif()

if(NOT BUILD_STATIC_MAVSDK_SERVER AND ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
target_link_libraries(mavsdk_server_bin PRIVATE ${CMAKE_DL_LIBS})
endif()

# MSVC fails to generate the `mavsdk_server` binary while having
# a library called `mavsdk_server` as well. This means that with
# MSVC, we build `mavsdk_server_bin.exe`.
Expand Down