cmake中添加引用动态链接和静态链接库

动态库的添加:

link_directories(${PROJECT_SOURCE_DIR}/lib) #添加动态连接库的路径
target_link_libraries(project_name -lmxnet ) #添加libmxnet.so

静态库的添加:

add_library(mxnet STATIC IMPORTED)
set_property(TARGET mxnet PROPERTY IMPORTED_LOCATION /path/to/libmxnet.a)
target_link_libraries(project_name mxnet ) #添加libmxnet.a

 

 

posted @ 2022-04-24 01:11  拼命的骡子  阅读(3880)  评论(0编辑  收藏  举报