From 45c5300496486ff9f1f3d47a01cdf19b8fa7e877 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Sat, 27 Nov 2021 19:58:04 +0100 Subject: cmake: Fix old style dependency lookup with imported targets This also includes some refactoring, since the alternaticve would have been to duplicate the huge traceparser target code block again. fixes #9581 --- mesonbuild/cmake/common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mesonbuild/cmake/common.py') diff --git a/mesonbuild/cmake/common.py b/mesonbuild/cmake/common.py index f6ba5ec..7130248 100644 --- a/mesonbuild/cmake/common.py +++ b/mesonbuild/cmake/common.py @@ -61,6 +61,18 @@ blacklist_cmake_defs = [ 'MESON_CMAKE_ROOT', ] +def cmake_is_debug(env: 'Environment') -> bool: + if OptionKey('b_vscrt') in env.coredata.options: + is_debug = env.coredata.get_option(OptionKey('buildtype')) == 'debug' + if env.coredata.options[OptionKey('b_vscrt')].value in {'mdd', 'mtd'}: + is_debug = True + return is_debug + else: + # Don't directly assign to is_debug to make mypy happy + debug_opt = env.coredata.get_option(OptionKey('debug')) + assert isinstance(debug_opt, bool) + return debug_opt + class CMakeException(MesonException): pass -- cgit v1.1