cmake-new is a minimal CMake project generator.
Usage
Usage: cmake-new <project> [options]
-l, --lang LANG Language (e.g., C, CXX, C++, C++20 (default))
-g, --generator GENERATOR CMake generator (e.g., Ninja (default), Unix Makefiles)
-t, --type TYPE Project type: exe (default) or lib
--vscode Generate VSCode files
--git Initialize a git repository (requires git)
Creating a new project
cmake-new new-projectOutput example
Project 'new-project' created with language C++20, generator Ninja, and type exe.
Configure, build, and run instructions:
cd new-project
cmake --preset debug
cmake --build --preset debug
./build/debug/new-project
Note: See more `CMakeLists.txt` commands and their definitions at
https://cmake.org/cmake/help/book/mastering-cmake/chapter/Writing%20CMakeLists%20Files.html
Newly created project tree
new-project
├── CMakeLists.txt
├── CMakePresets.json
├── README.md
└── src
└── main.cpp
Configuration File
An optional configuration file can be created in:
$HOME/.config/cmake-new.jsonor on Windows:
%APPDATA%\CMake-New\cmake-new.jsonExample configuration
{
"vscode": true,
"git": true
}Explanation of options
vscode— boolean value.trueenables generation of the VSCodelaunch.jsonandtasks.json. Defaults to false.git— boolean value.trueenables Git repository initialization. Defaults to false.git_branch— string. Ifgitis enabled andgit_branchis set, initializes the Git repository with the specified branch name.lang— string. Specifies the language standard for the project (e.g.,C,CXX,C++,C++20). Defaults toC++20if not specified.generator— string. Sets the CMake generator (e.g.,Ninja,Unix Makefiles). Defaults toNinja.type— string. Defines the project type, eitherexefor executables orlibfor libraries. Defaults toexe.