我正在尝试在我的程序中使用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()':
每个库都已编译完毕。似乎这些库彼此依赖,我必须将它们链接在一起或按特定顺序链接。有谁知道是否是这种情况?怎么做?
答案 0 :(得分:2)
这不是因为cmake而是内部live555依赖,它应该可以修改这样的顺序:
set(LIVE_LIBRARIES groupsock liveMedia BasicUsageEnvironment UsageEnvironment)