在meson.build中,我们可以添加类似add_global_arguments(...)
或-Dcpp_args
的内容,但是如何将其指定为某些buildtype?我在reference table中找不到任何内容。
您可以通过检查构建类型并在if-check中添加标志来实现。
buildtype = get_option('buildtype')
if buildtype == 'debug'
add_project_arguments([ '-DDEBUG' ], language: 'cpp')
endif
您可以在"Built-in options"的Meson页面上找到该选项的可能值>