Conan

from conan.tools.cmake import CMakeDeps

class MyLib(ConanFile):
    def build_requirements(self):
        self.tool_requires("mstring/[>=1.3 <2]")

    def generate(self):
        deps = CMakeDeps(self)
        deps.build_context_activated = ["mstring"]
        deps.build_context_build_modules = ["mstring"]
        deps.generate()
find_package(mstring 1.3 REQUIRED)     # defines mstring_generate()

mstring is an application package: an executable and the CMake module. It links cparse internally; that stays inside the tool. A library that generates its code with mstring does not pass mstring on to its own consumers — they get the generated headers.

Building mstring itself:

conan create .                      # tests run as part of the build
conan create . -o with_tests=False

pkg-config

For other build systems, the .pc file gives the executable:

pkg-config --variable=mstring mstring      # /usr/bin/mstring