From 358598816f69fd05842f30c9f55be21de7603c34 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 4 Jul 2016 19:49:04 +0530 Subject: [PATCH] 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. --- mesonbuild/build.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index d33f69219..1ff834cbb 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