Skip to content

Commit

Permalink
Merge pull request #2104 from mavlink/fix-dl-open
Browse files Browse the repository at this point in the history
Link CMAKE_DL_LIBS when necessary
  • Loading branch information
julianoes authored Aug 24, 2023
2 parents 84eab2d + a52f27a commit ab63cd8
Showing 1 changed file with 3 additions and 5 deletions.
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

0 comments on commit ab63cd8

Please sign in to comment.