Skip to content

Some CMake templates for building C/C++ projects quickly

Notifications You must be signed in to change notification settings

henryzhuhr/CMake-Templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMake-Templates

简体中文

这是一个 CMake 模板库

CMake

你可以在CMake官方网站找到下载链接官方文档以及一份简单的官方教程

CMake模板的结构

Cmake模板都是基于此目录进行的,具体每个项目的目录可能由于其需求不同而不同

.
├─.vscode           # VSCode 配置文件
|   ├─c_cpp_properties.json #
|   ├─launch.json           #
|   └─setting.json          #
├─app               # 测试文件目录
├─bin               # 二进制输出(编译后产生)
├─build             # cmake 构建和 make 编译输出文件目录
├─include           # 头文件
|   ├─<file>.hpp
|   └─...
├─src               # 源文件
├─tools             # 编译工具链(也可以将工具链添加到系统环境变量中)
├─.clang-format     # clang-format 文件(代码自动格式化工具)
├─build.bat         # bat 编译脚本
├─build.sh          # shell 编译脚本
├─CMakeLists.txt    # 根目录的CMake配置文件
└─README.md

CMake模板列表

编译一些有用的第三方库

gflags

download gflags in GitHub, see "Installing a binary distribution package"

常见的工具

CMake

添加环境变量 CMAKE_GENERATOR 到系统中,值为 MinGW Makefiles

Clang

Download

In LLVM official website, choose corresponding Clang-Format Release for your OS in Other builds.

Then, you can download LLVM in this page or in Github Release

when installing LLVM, in page Install Options, select if add LLVM to the system

  • Do not add LLVM to the system PATH
  • Add LLVM to the system PATH for all user
  • Add LLVM to the system PATH for current user

Usage

use clang-format with parameter -style and -i

  • -style LLVM、Google、Chromium、Mozilla、WebKit or file(.clang-format)
  • -i
clang-format -style=LLVM -i test.c

or you can edit your custom format file .clang-format,

clang-format -i test.c

see Clang documentation for more detail of using Clang-Format

git

in file .git/config

[remote "origin"]
	url = https://gitee.com/<user_name>/<repo_name>.git
	url = https://github.com/<user_name>/<repo_name>.git
	fetch = +refs/heads/*:refs/remotes/origin/*

Wget

A command-line utility for retrieving files using HTTP, HTTPS and FTP protocols.

Download:

About

Some CMake templates for building C/C++ projects quickly

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published