Merge branch 'master' of https://git.coding.net/lion187/NotePublic
This commit is contained in:
commit
0c80912dec
|
@ -14,6 +14,10 @@
|
|||
git config --global user.name
|
||||
git config --global user.email
|
||||
|
||||
git 访问某些 https 连接会出现 SSL 认证错误,此时可通过全局配置关闭 SSL 认证:
|
||||
|
||||
git config --global http.sslVerify "false"
|
||||
|
||||
### Git 与 SSH
|
||||
|
||||
如果想访问远程 Git 服务器,则最好通过 SSH 方式。这需要先生成 RSA 密钥,然后将公钥部署到远程服务器上即可。生成 RSA 密钥可使用 OpenSSH,命令如下(Windows 下该命令位于 /\<git 安装目录\>/usr/bin/ 下,可使用 Git Bash 直接访问):
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
# CMake 基本语法
|
||||
|
||||
CMake 支持大写、小写、混合大小写的命令。
|
||||
|
||||
## 最小版本号
|
||||
|
||||
```sh
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
```
|
||||
|
||||
## 工程名
|
||||
|
||||
```sh
|
||||
project(<Project Name>)
|
||||
```
|
||||
|
||||
## Include 路径
|
||||
|
||||
*需要出现在 add_executable 和 add_library 等之前。*
|
||||
|
||||
```sh
|
||||
include_directories(
|
||||
<Path1>
|
||||
<Path2>
|
||||
...
|
||||
<PathN>
|
||||
)
|
||||
```
|
||||
|
||||
## 添加库路径
|
||||
|
||||
*需要出现在 add_executable 和 add_library 等之前。*
|
||||
|
||||
```sh
|
||||
link_directories(
|
||||
<Path1>
|
||||
<Path2>
|
||||
...
|
||||
<PathN>
|
||||
)
|
||||
```
|
||||
|
||||
## 添加库文件
|
||||
|
||||
*已经被废弃了,需要出现在 add_executable 和 add_library 等之前。*
|
||||
|
||||
```sh
|
||||
link_libraries(
|
||||
<Library1>
|
||||
<Library2>
|
||||
...
|
||||
<LibraryN>
|
||||
)
|
||||
```
|
||||
|
||||
支持直接全路径的写法。
|
||||
|
||||
## 可执行文件目标和源码
|
||||
|
||||
```sh
|
||||
add_executable(
|
||||
<Executable Name>
|
||||
<Source1>
|
||||
<Source2>
|
||||
...
|
||||
<SourceN>
|
||||
)
|
||||
```
|
||||
|
||||
## 库文件目标和源码
|
||||
|
||||
```sh
|
||||
add_library(
|
||||
<Library>
|
||||
<SHARED/STATIC>
|
||||
<Source1>
|
||||
<Source2>
|
||||
...
|
||||
<SourceN>
|
||||
)
|
||||
```
|
||||
|
||||
## 为目标添加库文件
|
||||
|
||||
*可添加的动态库或静态库,可以在 add_executable 和 add_library 等之后。*
|
||||
|
||||
```sh
|
||||
target_link_libraries(
|
||||
<Target Name>
|
||||
<Library1>
|
||||
<Library2>
|
||||
...
|
||||
<LibraryN>
|
||||
)
|
||||
```
|
||||
|
||||
## 添加依赖工程
|
||||
|
||||
```sh
|
||||
add_dependencies(
|
||||
<Target Name>
|
||||
<Depend Target1>
|
||||
<Depend Target2>
|
||||
...
|
||||
<Depend TargetN>
|
||||
)
|
||||
```
|
||||
|
||||
## 参考资料
|
||||
|
||||
[cmake手册详解](https://blog.csdn.net/chengde6896383/article/details/81330564)
|
||||
[cmake 的link_libraries和target_link_libraries](https://blog.csdn.net/harryhare/article/details/89143410)
|
||||
[【学习cmake】cmake如何使用链接库 (link_directories, LINK_LIBRARIES, target_link_libraries,FIND_PACKAGE)实践篇2](https://blog.csdn.net/KYJL888/article/details/85109782)
|
Loading…
Reference in New Issue