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.
pull/417/head
Nirbheek Chauhan 9 years ago
parent 6bb9805749
commit 358598816f
  1. 7
      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

Loading…
Cancel
Save