meson icon indicating copy to clipboard operation
meson copied to clipboard

[Feature] Default options for cmake wraps

Open LDAP opened this issue 1 year ago • 1 comments

PR https://github.com/mesonbuild/meson/pull/11730 recently added CMake wraps.

Still, meson is missing a way to provide default options to the CMake subproject. This is required quite frequently, for example to disable tests or set the buildtype.

See https://github.com/mesonbuild/meson/pull/11730#issuecomment-1574291316 for context.

LDAP avatar May 31 '24 11:05 LDAP

Current workaround:

Add the cmake wrap, then use the cmake module as usual:

dep = dependency('name', required: false)
if not dep.found()
    cmake_options = cmake.subproject_options()
    cmake_options.add_cmake_defines(...)
    subp = cmake.subproject('name', options: cmake_options)
    dep = subp.dependency('target'),

LDAP avatar Jul 20 '24 00:07 LDAP