#生成连个同名库的过程 test.a test.so
add_library(test_static STATIC a.cpp)
add_library(test SHARED a.cpp)
#重命名 上一过程如果直接生成同名库会报错所有下一步骤在生成好后重命名
set_target_properties(test_static PROPERTIES OUTPUT_NAME “test”)
#调用的过程
#将动态库的目录引入
link_directories(./cmake-build-debug)
#添加具体需要引用的库名称 如果没有此步骤 将会在上一步添加的目录中自动寻找需要的库(默认只会是寻找动态库)
link_libraries(libtest.a)
#编译源代码
add_executable(hello main.cpp)
#将编译好的所有文件链接成最终的执行文件
target_link_libraries(hello test )