mcppdev is a simple, modern C++23 development skeleton.
It serves as a reference template for setting up a C++ project that uses C++20/23 Modules, Google Test, and Google Benchmark, all orchestrated by a modern CMake configuration.
The goal of this repository is to provide a minimal but correct example of how a modern C++ project can be structured today.
-
C++23 Standard
Configured for the latest standard (e.g.<print>,std::println). -
C++ Modules
Demonstrates how to define, compile, and import custom C++ modules (.cppm) using CMake’sCXX_MODULESfile set. -
Dependency Management
Uses CMakeFetchContentto automatically download and build dependencies. -
Testing
Integrated Google Test setup. -
Benchmarking
Integrated Google Benchmark setup.
.
├── benchmarks/ # Google Benchmark code
│ └── benchmark.cpp
├── src/ # Main source code and C++ Modules
│ ├── cppmhello.cppm # Example C++ module
│ └── main.cpp # Main entry point
├── tests/ # Unit tests
│ └── test.cpp
├── CMakeLists.txt # CMake build configuration
└── build.sh # Build helper script
To build this project, you need tools with C++23 and Modules support:
- CMake: 3.30 or newer
- Compiler (one of):
- Clang 16+
- GCC 14+
- MSVC (Visual Studio 2022)
- Build System:
- Ninja (recommended)
- Make
⚠️ Note: C++ Modules support is still evolving.
Exact compiler and CMake versions matter, especially when mixing modules with testing and benchmarking.
./build.shcmake -S . -B build -G Ninja
cmake --build buildAfter a successful build, run the main executable:
./build/run_mainHello mcppdev
Hello module mcppdev
This confirms that:
- The main executable was built correctly
- The C++ module (
cppmhello.cppm) was successfully compiled and imported
After building, run:
ctest --test-dir buildor
./build/run_tests./build/run_benchmarksMIT