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 ...
随机推荐
- SGU 521 North-East ( 二维LIS 线段树优化 )
521. "North-East" Time limit per test: 0.5 second(s)Memory limit: 262144 kilobytes input: ...
- unsolved question's solution
因为很懒,没有时间,只会口胡等等原因,所以有些题目就不打code了 $luogu:$ P1973 [NOI2011]Noi嘉年华: 时间离散化,预处理一个区间$[l,r]$内的最多活动个数$in[l] ...
- Redis---Redis与Memcached
4.Redis与Memcached 两者都是非关系型内存键值,主要有以下不同: 数据类型 Memcached仅支持字符串类型,而Redis支持五种不同的数据类型,可以更灵活地解决问题. 数据持 ...
- Antd时间选择框汉化问题总结------国际化全局设置
import zh_CN from 'antd/lib/locale-provider/zh_CN'; import 'moment/locale/zh-cn'; import { ConfigPro ...
- Centos克隆虚拟机后配置网络
修改网卡相关信息,复制第二个网卡的mac地址. vim /etc/udev/rules.d/70-persistent-net.rules 修改网卡的信息 vim /etc/sysconfig/net ...
- setState总结
react中的setState特点: 是异步操作函数: 组件在还没有渲染之前, this.setState 还没有被调用: 批量执行 State 转变时让 DOM 渲染更快(相对比一个一个的setSt ...
- 完整的node脚手架搭建服务
使用脚手架来搭建node服务,使用到了express架构,不熟悉的可以看下express官方文档:http://www.expressjs.com.cn/ 使用express直接生成服务的文档结构目录 ...
- 北京师范大学第十五届ACM决赛-重现赛J Just A String (kmp算法延伸)
链接:https://ac.nowcoder.com/acm/contest/3/J 来源:牛客网 Just A String 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 2621 ...
- AlphaStar: Mastering the Real-Time Strategy Game StarCraft II 博客要点
original blog: https://deepmind.com/blog/alphastar-mastering-real-time-strategy-game-starcraft-ii S ...
- 计蒜客 蓝桥模拟 H. 封印之门
Floyd算法,最短路,判断a,b是否相等. 代码: #include <cstdio> #include <cstdlib> #include <cstring> ...