aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-07-04 19:49:04 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-07-05 16:24:10 +0530
commit358598816f69fd05842f30c9f55be21de7603c34 (patch)
treeb807f689954134a58e3bc114892fac7af2e24de3
parent6bb9805749cd773cb5eb831308ac7f93b9552f28 (diff)
downloadmeson-358598816f69fd05842f30c9f55be21de7603c34.zip
meson-358598816f69fd05842f30c9f55be21de7603c34.tar.gz
meson-358598816f69fd05842f30c9f55be21de7603c34.tar.bz2
build: Fix implementation of sources_are_suffix
The first file might be a header file, in which case this test will fail, so check all the files till a match is found instead. Also remove duplicate and incorrect can_compile check. It just checks the suffix and we already check that above.
-rw-r--r--mesonbuild/build.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index d33f692..1ff834c 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -73,7 +73,10 @@ this but it's the best we can do given the way shell quoting works.
'''
def sources_are_suffix(sources, suffix):
- return len(sources) > 0 and sources[0].endswith('.' + suffix)
+ for source in sources:
+ if source.endswith('.' + suffix):
+ return True
+ return False
def compiler_is_msvc(sources, is_cross, env):
"""
@@ -96,7 +99,7 @@ def compiler_is_msvc(sources, is_cross, env):
compiler = env.detect_cpp_compiler(is_cross)
except MesonException:
return False
- if compiler and compiler.get_id() == 'msvc' and compiler.can_compile(sources[0]):
+ if compiler and compiler.get_id() == 'msvc':
return True
return False