Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: give example for add_custom_target and add_dependencies #6

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
17 changes: 0 additions & 17 deletions 04-cross-compie/CMakeLists.txt

This file was deleted.

14 changes: 0 additions & 14 deletions 04-cross-compie/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions 04-cross-compie/main.cpp

This file was deleted.

1 change: 0 additions & 1 deletion 07-cuda/README.md

This file was deleted.

28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# CMake教程
- 手把手教你使用C++玩转工程项目,学完后直接上手开源项目
## 课程大纲
1. 单个文件
2. 生成与使用库
3. 引用第三方库
4. 交叉编译
5. 单元测试
6. 编译优化
## 参考文件
[CMake Cookbook](https://www.bookstack.cn/read/CMake-Cookbook/content-chapter1-1.2-chinese.md)
# CMakeTutorial
- A useful tutorial for CMake

## Syllabus
- add_executable()
- add_library()
- target_link_libraries()
- target_include_directories()
- add_subdirectory()
- find_package()
- target_compile_definitions()
- target_compile_options()
- add_dependencies()
- add_custom_target()
- add_custom_command()
- execute_process()
- configure_file()
11 changes: 11 additions & 0 deletions README_bak_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CMake教程
- 手把手教你使用C++玩转工程项目,学完后直接上手开源项目
## 课程大纲
1. 单个文件
2. 生成与使用库
3. 引用第三方库
4. 交叉编译
5. 单元测试
6. 编译优化
## 参考文件
[CMake Cookbook](https://www.bookstack.cn/read/CMake-Cookbook/content-chapter1-1.2-chinese.md)
11 changes: 0 additions & 11 deletions abseil/CMakeLists.txt

This file was deleted.

12 changes: 0 additions & 12 deletions abseil/abseil_test.cpp

This file was deleted.

6 changes: 6 additions & 0 deletions add_custom_command/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(add_custom_target_test)
set(CMAKE_CXX_STANDARD 17)

add_executable(add_custom_target_test main.cpp)
add_custom_command(TARGET add_custom_target_test POST_BUILD COMMAND echo "Hello World")
2 changes: 2 additions & 0 deletions add_custom_command/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cp_file:
cp README.md README.md.bak
1 change: 1 addition & 0 deletions add_custom_command/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# add_custom_command
4 changes: 4 additions & 0 deletions add_custom_command/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <iostream>
int main(){
std::cout << "Hello World!" << std::endl;
}
7 changes: 7 additions & 0 deletions add_dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(add_custom_target_test)
set(CMAKE_CXX_STANDARD 17)

add_executable(add_custom_target_test main.cpp)
add_custom_target(run_test COMMAND cp ../README.md README.md.bak)
add_dependencies(run_test add_custom_target_test)
Empty file added add_dependencies/README.md
Empty file.
4 changes: 4 additions & 0 deletions add_dependencies/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <iostream>
int main(){
std::cout << "Hello World!" << std::endl;
}
17 changes: 0 additions & 17 deletions arrow/CMakeLists.txt

This file was deleted.

73 changes: 0 additions & 73 deletions arrow/main.cpp

This file was deleted.

Binary file removed catch_v2/.DS_Store
Binary file not shown.
4 changes: 0 additions & 4 deletions catch_v2/CMakeLists.txt

This file was deleted.

Loading
Loading