CMake template for rapid prototyping and testing C++ code snippets.
- Auto-detects source files with
main()
- Integrated Clang-Formatting (automatic code formating before building)
- C++20 by default
- Cross-platform support
- Per-target compile definitions via
.cfg
files - Automatic reconfiguration on file changes
cmake -B build
cmake --build build
probe/
├─ CMakeLists.txt # Main CMake configuration
├─ cmake/ # Custom CMake scripts and modules
├─ include/ # Public headers (visible to all targets)
└─ src/ # Implementation & private headers
*.h
/*.hpp
: Public headers (visible to all targets and external projects).
*.cpp
: Implementation files.- Files containing
main()
are built as executables. - Files without
main()
are compiled into OBJECT libraries.
- Files containing
*.h
/*.hpp
: Private headers (visible only withinsrc/
).- Files and directories starting with
_
are ignored (e.g.,_internal.cpp
,_private/
).
<name>.cfg
: Per-target compile definitions.- Automatically loaded if a file with the same base name as the source file exists.
- Example:
app.cpp
→app.cfg
.
#include <iostream>
int main()
{
#ifdef MY_CUSTOM_DEFINE
std::cout << "Hello, World!\n";
#endif
return 0;
}
MY_CUSTOM_DEFINE=1