Skip to content

Commit

Permalink
change max heading level to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jerksnapcrackle committed Sep 19, 2024
1 parent 51a3f65 commit 67338d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions archive/cmake_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout: post
[https://cmake.org/cmake/help/latest/guide/tutorial/index.html](https://cmake.org/cmake/help/latest/guide/tutorial/index.html).
基于cmake 3.26.3

# 目录
### 目录

1. [最基础的工程](#basic)
2. [指定c++版本](#version)
Expand All @@ -20,7 +20,7 @@ layout: post
9. [GoogleTest](#gtest)

<a name="basic"></a>
## 最基础的工程
### 最基础的工程
目录结构如下:
```
.
Expand Down Expand Up @@ -76,7 +76,7 @@ hello cmake
```

<a name="version"></a>
## 指定c++版本
### 指定c++版本
方法1:
```
set(CMAKE_CXX_STANDARD 20) #指定默认使用c++20
Expand All @@ -92,7 +92,7 @@ target_compile_feature(${PROJECT_NAME} PUBLIC cxx_std_20)
所有支持的feature可以通过[CMAKE_KNOWN_FEATURES](https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES)查看。此外还有CMAKE_C_KNOWN_FEATURES,CMAKE_CUDA_KNOWN_FEATURES等。

<a name="marco"></a>
## 传递宏
### 传递宏
通过configure_file可以将CMakeLists.txt中定义的参数通过形如`@VAR@`的宏的形式传入源文件,其流程如下:
![configure_file](../img/cmake_tutorial/configure_file.png)
首先在工程目录中添加config.h.in:
Expand Down Expand Up @@ -170,7 +170,7 @@ this is var1
```

<a name="self-lib"></a>
## 自建库的方法
### 自建库的方法
根目录下创建strlib目录,中间放入strlib.h,str.cpp,CMakeLists.txt文件:
```bash
.
Expand Down Expand Up @@ -251,7 +251,7 @@ hello
```

<a name="self-lib-switch"></a>
## 为自建库添加开关
### 为自建库添加开关
也就是通过option指令来在cmake时通过参数来选择是否将库包含入源文件:
```
option(USE_STRLIB "if use strlib" ON) #添加USE_STRLIB选项作为开关
Expand Down Expand Up @@ -342,7 +342,7 @@ hello(lib)
```

<a name="better-self-lib"></a>
## 更好的链接库的方法
### 更好的链接库的方法
在strlib的CMakeLists.txt里include需要的头文件而不在basic的CMakeLists.txt里include。
strlib的CMakeLists.txt:
```
Expand Down Expand Up @@ -377,7 +377,7 @@ target_link_libraries(
```

<a name="install"></a>
## 安装
### 安装
有时我们希望可以直接用指令的方式调用程序,在cmake中通过install就可以做到。
在这个例子中打算用[date](https://github.com/HowardHinnant/date)库做一个简单的查询本地时间的程序。

Expand Down Expand Up @@ -536,7 +536,7 @@ export PATH="$PATH:$HOME/bin"
具体可以查看[github仓库](https://github.com/jooooow/ctime)

<a name="macro"></a>
## 传递宏
### 传递宏
add_defintions命令为源文件的编译添加-D指令,也就是添加宏。
通过定义cmake变量来控制add_defintions的执行,从而可以实现宏的开关/传递:
```
Expand Down Expand Up @@ -567,7 +567,7 @@ message( "COMPILE_DEFINITIONS = ${DirDefs}" )
```

<a name="gtest"></a>
## GoogleTest
### GoogleTest

GoogleTest是常用的单元测试框架,详细可以参考[官方教程](https://google.github.io/googletest/primer.html)

Expand Down
12 changes: 6 additions & 6 deletions archive/git_cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ title: "Git Cheatsheet"
layout: post
---

# Brief
## Brief
This blog aims to memo some useful but not daily used commands.

# Reference
## Reference
[progit](https://www.progit.cn)

# Commands
## Commands

## 1. Untract staged files
### 1. Untract staged files
```bash
git rm -r --cached .
git add .
...
```

## 2. Rename a file
### 2. Rename a file

```bash
git mv file_from file_to
Expand All @@ -32,7 +32,7 @@ git mv file_from
git add file_to
```

## 3. Add tag
### 3. Add tag
+ add tag to current commit

```bash
Expand Down

0 comments on commit 67338d8

Please sign in to comment.