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 docs target.

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 optionDefault
TESTINGONtests/
EXAMPLEONexamples/ and their smoke tests
BENCHOFFbench/, the per-call benchmark
MSTRING_DOCS_WARN_AS_ERROROFFfail 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/mstringthe generator
lib/cmake/mstring/mstring-generate.cmakemstring_generate()
share/pkgconfig/mstring.pcthe 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