Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Diyou/.cmake

Repository files navigation

dotcmake

CMake configuration suite for common multiplatform c++ projects

Content:

Requirement:

  • cmake > 4.0.0
    • gcc > 15
    • clang > 19

Usage:

Add this repository as a git-submodule and include CMakePresets.json in the top-level project.
Cross-Compile targets are enabled via environment variables:

Target Environment Variable Example
debug
release
debug::clang
release::clang
debug::emscripten
release::emscripten
EMSCRIPTEN_ROOT
EMSDK [1]
/usr/lib/emscripten
.cache/emsdk
debug::android
release::android
ANDROID_HOME
JAVA_HOME [2]
~/Android/Sdk
/opt/android-studio/jbr

[1] If EMSCRIPTEN_ROOT is unset use existing EMSDK or install emsdk at that location
[2] Optional but preferred JDK location (fallback to system Java)

Quick Setup:

From an empty directory run:

git init && git submodule add https://github.com/Diyou/.cmake && .cmake/setup c++

IDE integration:

Vscode

  • PRESETS:

    • For vscode extensions to see environment variables export them in ~/.profile and run source ~/.profile && /usr/bin/code or similar
  • DEBUGGING:

    • .cmake can automatically copy launch configurations (launch.json) into .vscode depending on the currently configured compiler (see Options)
    • [F5] or launch the default configuration
      NOTE: Don't use the cmake-tools debug icon
  • Intellisense:

    Until cpptools fully supports c++20 modules and import std; I suggest to install vscode-clangd and disable the intellisense engine
    .cmake can adjust the clangd.path automatically when cross-compiling
    NOTE: Run the 'clangd: Restart language server' command after switching presets or initial build.

About

CMake configuration suite for common multiplatform c++ projects

Topics

Resources

License

Stars

Watchers

Forks