cmake所需依赖表示
-D 参数
-D XX_INCLUDE_DIR [此处设置所需包的头文件目录]
-D XX_LIBRARY [此处设置所需动态链接库.so文件的路径]
缺何种依赖可以根据所报错误来进行判断
如下是一个完整的cmake编译命令:
cmake编译举例
上图的cmake编译报错:VALGRIND_INCLUDE_DIR variables are used in this project, but they are set to NOTFOUND.
我们此时需要valgrind,若已经安装了valgrind,则可以通过**whereis valgrind** (which valgrind查找命令位置)来查找valgrind的安装目录;
我们的安装目录为:/usr/software/valgrind,所以可设置 VALGRIND_INCLUDE_DIR="/usr/software/valgrind/include/"。所以最终安装命令为:
cmake -D CMAKE_BUILD_TYPE=$TYPE -D USE_BDB=OFF -D USE_TDB=ON -D BUILD_TESTING=OFF \
-D VALGRIND_INCLUDE_DIR="/usr/software/valgrind/include/" -D CMAKE_INSTALL_PREFIX=../ft-install/ \
-D BUILD_FOR_LINUX_KERNEL_MODULE=ON ..