当前位置: 首页 > 工具软件 > Ubuntu Make > 使用案例 >

ubuntu cmake和make编译添加依赖库的区别

卓致远
2023-12-01

1.编译过程指定依赖包的路径

1>cmake指定,在CMakeLists.txt文件中添加

set(OpenCV_DIR "/usr/local/opencv3.4/share/OpenCV")
find_package(OpenCV 3.4 REQUIRED COMPONENTS core highgui imgproc flann 	calib3d)  
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})

2>make指定 ,在Makefile文件中 添加

INCLUDES = -I/usr/local/opencv3.4/include/opencv  #INCLUDES 指定了头文件的路径
LIBS = -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml # LIBS 指定了需		要哪些库
LIBDIRS = -L/usr/local/opencv3.4//lib #LIBDIRS 指定了需要的库的路径

2.查看庫和庫中函數是否存在

grep cvSomeFunction *.so
nm someOpenCVLib.so | grep cvSomeFunction

 类似资料: