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-project
Output 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.json
or on Windows:
%APPDATA%\CMake-New\cmake-new.json
Example configuration
{
"vscode": true,
"git": true
}
Explanation of options
vscode
— boolean value.true
enables generation of the VSCodelaunch.json
andtasks.json
. Defaults to false.git
— boolean value.true
enables Git repository initialization. Defaults to false.git_branch
— string. Ifgit
is enabled andgit_branch
is 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++20
if not specified.generator
— string. Sets the CMake generator (e.g.,Ninja
,Unix Makefiles
). Defaults toNinja
.type
— string. Defines the project type, eitherexe
for executables orlib
for libraries. Defaults toexe
.