链接 多个库进行编译

CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)

PROJECT(mytest)


INCLUDE_DIRECTORIES(/home/book/work/myffmpeg/sharelib/include)

#AUX_SOURCE_DIRECTORY(/home/book/work/myffmpeg/sharelib/lib Mylib)

ADD_EXECUTABLE(myteset myopen.c)

#TARGET_LINK_LIBRARIES(myteset /home/book/work/myffmpeg/ffmpeg/libavcodec/libavcodec.so)

file(GLOB LIBS "/home/book/work/myffmpeg/sharelib/lib/lib*.so")
#/home/book/work/myffmpeg/sharelib/lib
target_link_libraries(myteset PRIVATE ${LIBS})

参考:
​​​[cmake]如何使用通配符同时添加多个lib库文件依赖​