aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2017-08-23 08:39:09 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2017-08-23 15:39:09 +0300
commit48e7398add38685590ca85526b4e5cd68cd72872 (patch)
tree033ec6e22269b08fc298a9ce3237b54bd3c68570 /mesonbuild/environment.py
parentf83be23d55df71fd0effd744f00b0b18d364635d (diff)
downloadmeson-48e7398add38685590ca85526b4e5cd68cd72872.zip
meson-48e7398add38685590ca85526b4e5cd68cd72872.tar.gz
meson-48e7398add38685590ca85526b4e5cd68cd72872.tar.bz2
Check if Watcom version of cl exists in the path and avoid using it. (#2237)
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 7ac2321..0b2a159 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'