CMake 打包已经存在的动态库生成 target
一. 背景在 CMakeLists.txt 中,某模块 A 通过 add_subdirectory 引入模块 B ,模块 B 通过 add_subdirectory 引入模块 C。模块 C 里面本身就是一个开源的动态库,比如 libtask。目的想要将 C 模块打包成一个 Target ,以便在 A 模块中中使用方便。二. 旧版本实现和存在问题A 模块不直接使用 C 模块,但是 A 模块使用到了 B 模块,B 模块编译依赖 C 模块,就需要导致 A 编译时要通过下面的方式引入 C 模块 incl






