mstring is a command-line tool plus a CMake function. It builds from source; its only dependency is cparse, the parser library, which comes from Conan.
Requirements
- A C++17 compiler (GCC 11+, Clang 14+).
- CMake ≥ 3.20, Conan 2.
- The cparse and ffs-packaging-tools Conan packages (in the fedem Conan cache / remote).
- Optional: Doxygen + Graphviz for the
docstarget.
The generated code needs only a C++17 standard library.
With Conan
tar xzf mstring-1.3.0.0.tar.gz && cd mstring-1.3.0.0
conan create . # build, run the tests, package
The tests (ctest, about 40 of them) compile the code mstring generates for every feature with -Wall -Wextra -Wpedantic -Werror and run it. Skip them with -o with_tests=False.
Then, in a project that generates code with it:
def build_requirements(self):
self.tool_requires("mstring/[>=1.3 <2]")
and see Conan & pkg-config for the CMakeDeps lines.
For development
conan install . --build=missing
cmake --preset conan-release
cmake --build --preset conan-release
ctest --test-dir build/Release --output-on-failure
| CMake option | Default | |
|---|---|---|
TESTING | ON | tests/ |
EXAMPLE | ON | examples/ and their smoke tests |
BENCH | OFF | bench/, the per-call benchmark |
MSTRING_DOCS_WARN_AS_ERROR | OFF | fail the docs target on a Doxygen warning |
cmake --build --preset conan-release --target docs writes the Doxygen tree to build/Release/docs/html/.
What gets installed
| Path | |
|---|---|
bin/mstring | the generator |
lib/cmake/mstring/mstring-generate.cmake | mstring_generate() |
share/pkgconfig/mstring.pc | the executable's path for other build systems |
share/doc/mstring/ | LICENSE, README.md, syntax.md |
CPack produces TGZ / RPM / DEB packages (cpack in the build folder).
Check it
echo '$STRING ENABLE
$MESSAGE Hi
"hi"' | mstring -m hi
ls hi.hh hi.cpp

