Skip to content

collindutrow/cmake-new

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

CMake-New

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 VSCode launch.json and tasks.json. Defaults to false.
  • git — boolean value. true enables Git repository initialization. Defaults to false.
  • git_branch — string. If git is enabled and git_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 to C++20 if not specified.
  • generator — string. Sets the CMake generator (e.g., Ninja, Unix Makefiles). Defaults to Ninja.
  • type — string. Defines the project type, either exe for executables or lib for libraries. Defaults to exe.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages