3

我正在尝试在我的程序中使用 live555 库。我使用 CMake 作为构建系统。我做了这个 CMakeLists.txt :

aux_source_directory(. SRC_LIST)
include_directories("${PROJECT_SOURCE_DIR}/libs/live/BasicUsageEnvironment/include")
include_directories("${PROJECT_SOURCE_DIR}/libs/live/UsageEnvironment/include")
include_directories("${PROJECT_SOURCE_DIR}/libs/live/groupsock/include")
include_directories("${PROJECT_SOURCE_DIR}/libs/live/liveMedia/include")
link_directories("${PROJECT_SOURCE_DIR}/libs/live/BasicUsageEnvironment")
link_directories("${PROJECT_SOURCE_DIR}/libs/live/UsageEnvironment")
link_directories("${PROJECT_SOURCE_DIR}/libs/live/groupsock")
link_directories("${PROJECT_SOURCE_DIR}/libs/live/liveMedia")
add_executable(${PROJECT_NAME} ${SRC_LIST})
set(LIVE_LIBRARIES BasicUsageEnvironment UsageEnvironment groupsock liveMedia)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} x264 avcodec swscale ${LIVE_LIBRARIES})

编译/链接我得到了很多类似这样的错误:

/home/davide/program/libs/live/groupsock/libgroupsock.a(NetAddress.o):-1: In function `AddressPortLookupTable::AddressPortLookupTable()':

每个库都已编译。似乎这些库相互依赖,我必须将它们链接在一起或按特定顺序链接。有谁知道是否是这种情况?怎么做?

4

1 回答 1

4

这不是由于 cmake 而是由于内部 live555 依赖关系,它应该可以像这样修改顺序:

set(LIVE_LIBRARIES groupsock liveMedia BasicUsageEnvironment UsageEnvironment)
于 2014-08-15T17:55:09.470 回答