1. 程式人生 > >cmake中新增引用動態連結和靜態連結庫

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