CMake----if与option使用小记】的更多相关文章

最近将项目迁移到CMake进行管理,对CMake进行了一些研究,觉得有一些命令非常实用但很少有资料提到,在这里做一个总结,至于太普通常用的命令就不提了. OPTION(OPTION_VAR "Description" [initial value]):用于管理编译选项,定义并初始化自定义变量. 例: OPTION(BUILD_TEST "Build the test project" ON) FIND_PATH(<VAR> name path1 path…
在CMake中if语法比较简单,if后面括号中的参数随着CMake版本的推进,在else和endif中也可以不用写了. if(address) else() endif() 对于if语法,比较常用的就是字符串比较了,这里个人简单用到过两种,一种是这个变量有没有定义过.有两种写法可以验证 if(DEFINED address) else() endif() if(address) else() endif() 两种都可以验证这个变量有没有定义过,注意:是定义过,比如你在CMake命令行中随便写了-…
1.cmake 显示编译命令: 在顶层CMakeLists.txt里设置 set(CMAKE_VERBOSE_MAKEFILE ON) 或者  cmake .        再           make VERBOSE=1 或  cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .         再   make 最好: cmake -DCMAKE_RULE_MESSAGES:BOOL=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .…
将所有文件的编码,转换为UTF-8 find . ! -type d -exec enca -L zh_CN -x UTF-8 {} \; 将指定目录下所有文件权限设定为644 find . ! -type d -exec chmod 644 {} \; 将指定目录下所有目录权限设定为755 find . -type d -exec chmod 755 {} \; 替换文本文件中行尾换行符,从dos(CRLF)为unix行尾换行符: find . -name '*.php' | xargs -I…
目录 换源 开发相关的基本包 vimrc python, pip zsh, oh-my-zsh, josh 配置android相关环境 查看库文件(libxxx.a/libxxx.so,动态静态库均可)是哪个编译器生成的 ldd查看动态库的依赖项 nvidia-smi反应慢 查找ppa软件包 U盘启动ubuntu(安装),进不去桌面 安装软件包/编译常见软件包 查找包 安装软件到系统路径 编译时提示头文件找不到 双"重定向" 装ffmpeg 编译安装opencv和opencv cont…
Makefile Makefile 的格式 target: prerequisites [tab]command 例子 #Makefile all:chap1 chap2 chap1: - - - : 1_1.c gcc -o o_1_1 1_1.c -lc - : 1_2.c gcc -o o_1_2 1_2.c -lc chap2: - - -: 2_1.c gcc -o o_2_1 2_1.c -lc -: 2_2.c gcc -o o_2_2 2_2.c -lc clean: rm o_…
1.Installing the MongoDB C Driver (libmongoc) and BSON library (libbson) Building on Windows with Visual Studio Building on Windows requires Windows Vista or newer and Visual Studio 2010 or newer. Additionally, cmake is required to generate Visual St…
1. Foreword 前言 2. Who should read this document? 谁适合读该文档? 3. Acknowledgements 致谢 4. About this document 关于本文档 5. Where to get the latest copy of this document? 哪里获取本文档最新副版 6. Providing feedback about this document 反馈 7. Typographic Conventions 版式约定 7…
一.cofigure是怎么生成的,我们又是怎么使用的 configure和make install背后的故事: https://azyet.github.io/2015/06/20/configureAndMakeInstall/ 二.cmake怎么用的 2.1 cmake参考材料 cmake入门: http://linghutf.github.io/2016/06/16/cmake/ cmake-book: https://chenxiaowei.gitbook.io/cmake-cookbo…
背景:在学习如何往ONNXRuntime中添加新算子时,参考了官方测试代码:onnxruntime/test/shared_lib/test_inference.cc,代码内部使用GTest作为单元测试工具.为了清楚地学习运行过程,一步一步地调试是不可缺少的. 开始调试前需要以Debug方式编译代码库,同时别忘了开启测试开关: // cmake/CMakeLists.txt ... option(onnxruntime_BUILD_UNIT_TESTS "Build ONNXRuntime un…