cmake: Always use all compilers for LLVM (fixes #10249)

pull/9988/head
Daniel Mensinger 3 years ago committed by Eli Schwartz
parent 0176419bec
commit 589600cb51
  1. 4
      mesonbuild/dependencies/cmake.py
  2. 1
      mesonbuild/dependencies/data/CMakeListsLLVM.txt
  3. 13
      mesonbuild/dependencies/dev.py

@ -76,10 +76,10 @@ class CMakeDependency(ExternalDependency):
# one module
return module
def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None) -> None:
def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None, force_use_global_compilers: bool = False) -> None:
# Gather a list of all languages to support
self.language_list = [] # type: T.List[str]
if language is None:
if language is None or force_use_global_compilers:
compilers = None
if kwargs.get('native', False):
compilers = environment.coredata.compilers.build

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )
set(PACKAGE_FOUND FALSE)

@ -404,7 +404,18 @@ class LLVMDependencyCMake(CMakeDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
self.llvm_modules = stringlistify(extract_as_list(kwargs, 'modules'))
self.llvm_opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules'))
super().__init__(name, env, kwargs, language='cpp')
compilers = None
if kwargs.get('native', False):
compilers = env.coredata.compilers.build
else:
compilers = env.coredata.compilers.host
if not compilers or not all(x in compilers for x in ('c', 'cpp')):
self.is_found = False
mlog.warning('The LLVM dependency was not found via CMake since both a C and C++ compiler are required.')
return
super().__init__(name, env, kwargs, language='cpp', force_use_global_compilers=True)
# Cmake will always create a statically linked binary, so don't use
# cmake if dynamic is required

Loading…
Cancel
Save