From 48e7398add38685590ca85526b4e5cd68cd72872 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Wed, 23 Aug 2017 08:39:09 -0400 Subject: Check if Watcom version of cl exists in the path and avoid using it. (#2237) --- mesonbuild/environment.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 7ac232156..0b2a159fd 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -511,6 +511,24 @@ class Environment: if isinstance(compiler, str): compiler = [compiler] if 'cl' in compiler or 'cl.exe' in compiler: + # Watcom C provides it's own cl.exe clone that mimics an older + # version of Microsoft's compiler. Since Watcom's cl.exe is + # just a wrapper, we skip using it if we detect its presence + # so as not to confuse Meson when configuring for MSVC. + # + # Additionally the help text of Watcom's cl.exe is paged, and + # the binary will not exit without human intervention. In + # practice, Meson will block waiting for Watcom's cl.exe to + # exit, which requires user input and thus will never exit. + if 'WATCOM' in os.environ: + def sanitize(p): + return os.path.normcase(os.path.abspath(p)) + + watcom_cls = [sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl')), + sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl.exe'))] + found_cl = sanitize(shutil.which('cl')) + if found_cl in watcom_cls: + continue arg = '/?' else: arg = '--version' -- cgit v1.2.3