Skip to content

cmake: Fix toolchain including unsupported languages #14618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mesonbuild/cmake/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'cuda': 'CUDA',
'objc': 'OBJC',
'objcpp': 'OBJCXX',
'nasm': 'ASM_NASM',
'cs': 'CSharp',
'java': 'Java',
'fortran': 'Fortran',
Expand Down
9 changes: 7 additions & 2 deletions mesonbuild/cmake/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ def make_abs(exe: str) -> str:

# Set the compiler variables
for lang, comp_obj in self.compilers.items():
prefix = 'CMAKE_{}_'.format(language_map.get(lang, lang.upper()))
language = language_map.get(lang, None)

if not language:
continue # unsupported language

prefix = 'CMAKE_{}_'.format(language)

exe_list = comp_obj.get_exelist()
if not exe_list:
Expand Down Expand Up @@ -211,7 +216,7 @@ def update_cmake_compiler_state(self) -> None:
# Generate the CMakeLists.txt
mlog.debug('CMake Toolchain: Calling CMake once to generate the compiler state')
languages = list(self.compilers.keys())
lang_ids = [language_map.get(x, x.upper()) for x in languages]
lang_ids = [language_map.get(x) for x in languages if x in language_map]
cmake_content = dedent(f'''
cmake_minimum_required(VERSION 3.10)
project(CompInfo {' '.join(lang_ids)})
Expand Down
Loading