CMakeLists.txt 语法
命令不区分大小写(参数区分大小写)
add_executable(demo main.cpp main.h main.rc)
用main.cpp源文件,main.h文件,main.rc文件构造可执行文件。至于如何使用这些文件, CMake比我们都清楚。
用 SET 设置变量
SET( MY_SOURCES main.cpp widget.cpp)
用 FOREACH 迭代
FOREACH(next_ITEM ${MY_SOURCES})
MESSAGE(STATUS "next item: ${next_ITEM}")
ENDFOREACH(next_ITEM ${MY_SOURCES})
定义一个宏 hello
MACRO(hello MESSAGE)
MESSAGE(${MESSAGE})
ENDMACRO()
使用
hello("Hello World")
string 操作
string(REGEX MATCH <regular_expression>
<output variable> <input> [<input>...])
string(REGEX MATCHALL <regular_expression>
<output variable> <input> [<input>...])
string(REGEX REPLACE <regular_expression>
<replace_expression> <output variable>
<input> [<input>...])
string(REPLACE <match_string>
<replace_string> <output variable>
<input> [<input>...])
string(CONCAT <output variable> [<input>...])
string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>
<output variable> <input>)
string(COMPARE EQUAL <string1> <string2> <output variable>)
string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
string(COMPARE LESS <string1> <string2> <output variable>)
string(COMPARE GREATER <string1> <string2> <output variable>)
string(ASCII <number> [<number> ...] <output variable>)
string(CONFIGURE <string1> <output variable>
[@ONLY] [ESCAPE_QUOTES])
string(TOUPPER <string1> <output variable>)
string(TOLOWER <string1> <output variable>)
string(LENGTH <string> <output variable>)
string(SUBSTRING <string> <begin> <length> <output variable>)
string(STRIP <string> <output variable>)
string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>]
[RANDOM_SEED <seed>] <output variable>)
string(FIND <string> <substring> <output variable> [REVERSE])
string(TIMESTAMP <output variable> [<format string>] [UTC])
string(MAKE_C_IDENTIFIER <input string> <output variable>)
Check if given C source compiles and links into an executable
CHECK_C_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>]) <code> - source code to try to compile, must define 'main'
<var> - variable to store whether the source code compiled
Will be created as an internal cache variable.
<fail-regex> - fail if test output matches this regex
The following variables may be set before calling this macro to modify the way the check is run:
CMAKE_REQUIRED_FLAGS = string of compile command line flags
CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
CMAKE_REQUIRED_INCLUDES = list of include directories
CMAKE_REQUIRED_LIBRARIES = list of libraries to link
CMAKE_REQUIRED_QUIET = execute quietly without messages
CMakeLists.txt 语法的更多相关文章
- linux CMakeLists.txt 语法
CMake入门教程 参考文献:http://www.ibm.com/developerworks/cn/linux/l-cn-cmake/index.html 官方网址:http://www.cmak ...
- CMakeLists.txt使用
背景:C++代码在编译的过程中需要进行文件的包含,该文主要介绍CMakeLists.txt相关语法 CMake之CMakeLists.txt编写入门
- Ros学习——Cmakelists.txt文件解读
1.过程 .Required CMake Version (cmake_minimum_required) //CMake 需要的版本 .Package Name (project()) //#定义工 ...
- [forward] cmake, CMakeLists.txt梳理
cmake intro 原文请见 cmake使用总结(转)-工程主目录CMakeList文件编写 在 Linux 下进行开发很多人选择编写 makefile 文件进行项目环境搭建,而makefile ...
- CMake之CMakeLists.txt编写入门
自定义变量 主要有隐式定义和显式定义两种. 隐式定义的一个例子是PROJECT指令,它会隐式的定义< projectname >_BINARY_DIR和< projectname & ...
- Linux 编译工具 gcc/g++、Make/Makefile、CMake/CMakeLists.txt、qmake
前言 编译器的主要工作流程: 源码(Source Code)>> 预处理器(Preprocessor)>> 编译器(Compiler)>> 汇编程序(Assembl ...
- Sophus库CMakeLists.txt内容详解笔记
CMakeLists.txt: SET(PROJECT_NAME Sophus) PROJECT(${PROJECT_NAME}) CMAKE_MINIMUM_REQUIRED(VERSION 2.6 ...
- 简单CMakeLists.txt文件
#CMakeLists.txt cmake_minimum_required(VERSION 2.8) project(server) #添加包含目录 include_directories(./in ...
- CMAKE 生成VS2008静态库工程 与 CMAKE使用,CMakeLists.txt编写总结
cmake -G"Visual Studio 9 2008 Win64" 以上命令得用cd命令切换到顶层CMakeLists.txt的当前目录,才能生效 以下是CMakeLists ...
随机推荐
- 如何配置vsftpd服务器
1,通过yum查看本地是否存在vsftpd rpm -qa|grep vsftpd [root@node2 ~]# rpm -qa |grep vsftpdvsftpd-3.0.2-25.el7.x8 ...
- hdu1263 简单模拟
题意:依据水果销量表.依照特定格式输出 格式:首先按产地排序,然后同一产地按水果名排序 注意:第一,设计多级排序 第二.同一产地同一水果可能多次出现,所以须要在前面已经输入的水果里 ...
- Client does not support authentication protocol requested by server; consider upgrading MySQL client
出现错误 Client does not support authentication protocol requested by server; consider upgrading MySQL c ...
- 31. Next Permutation (JAVA)
Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...
- WPS专业版及序列号
目录 1. 软件下载 2. 序列号(永久) 1. 软件下载 城通网盘:https://sn9.us/dir/13403389-35833830-3fc98f (仅Android版) 官网: https ...
- linux NFS 实例
为了证明是 Allentunsgroup 组起的作用而非用户 [root@NFS_Client ~]# useradd scott1 [root@NFS_Client ~]# passwd scott ...
- java web请求过程
小技巧: 1.浏览器缓存 Ctrl+F5组合键刷新页面,浏览器会直接向目标URL发送请求,而不会使用浏览器缓存,并会在HTTP请求header中增加下面的请求头来告诉服务器不使用服务器缓存 发现在re ...
- CentOS上安装Git及配置远程仓库
首先登陆CentOS服务器,连接上服务器之后我们使用yum remove git 命令删除已安装的Git,若之前没安装过Git则不需要这一步.注意前提是你的CentOS服务器上安装了yum,这是Cen ...
- SpringBoot之初体验
一.SpringBoot 介绍 1.1 SpringBoot 使命 在之前我们学习 Spring 时,我们了解到 Spring 最根本的使命就是 简化Java开发.而 SpringBoot 的出现也有 ...
- httprunner
https://cn.httprunner.org/quickstart/ httprunner官方 https://testerhome.com/opensource_projects/httpru ...