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

Conversation

amyspark
Copy link
Contributor

The most egregious cases are Nasm (which needs to be transformed to ASM_NASM) and Rust (which is not yet supported by CMake).

Without this change, projects including multiple languages will generate a toolchain file e.g.

set(CMAKE_SIZEOF_VOID_P "8")
set(CMAKE_C_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/HostX64/x64/cl.EXE")
set(CMAKE_CXX_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/HostX64/x64/cl.EXE")
set(CMAKE_RUST_COMPILER "C:/Users/Amalia/.cargo/bin/rustc.EXE" "-C" "linker=link")
set(CMAKE_NASM_COMPILER "C:/Users/Amalia/.cargo/bin/nasm.EXE")

which will then cause:

WARNING: CMake Toolchain: Failed to determine CMake compilers state
 -- return code: 1
 -- stdout: Put cmake in trace mode, but with variables expanded.
 -- stdout: Put cmake in trace mode and sets the trace output format.
 -- stdout: Not searching for unused variables given on the command line.
 -- stdout: Put cmake in trace mode and redirect trace output to a file instead of stderr.
 -- stdout: Trace will be written to cmake_trace.txt
 -- stdout: -- Configuring incomplete, errors occurred!
 -- stdout: 
 -- stderr: CMake Error: Could not find cmake module file: CMakeDetermineRUSTCompiler.cmake
 -- stderr: CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
 -- stderr: Missing variable is:
 -- stderr: CMAKE_RUST_COMPILER_ENV_VAR
 -- stderr: CMake Error: Could not find cmake module file: E:/gstreamer/build/meson-private/__CMake_compiler_info__/CMakeFiles/3.27.9/CMakeRUSTCompiler.cmake
 -- stderr: CMake Error at CMakeLists.txt:3 (project):
 -- stderr:   The CMAKE_RUST_COMPILER:
 -- stderr: 
 -- stderr:     C:/Users/Amalia/.cargo/bin/rustc.EXE;-C;linker=link
 -- stderr: 
 -- stderr:   is not a full path to an existing compiler tool.
 -- stderr: 
 -- stderr:   Tell CMake where to find the compiler by setting the CMake cache entry
 -- stderr:   CMAKE_RUST_COMPILER to the full path to the compiler, or to the compiler
 -- stderr:   name if it is in the PATH.
 -- stderr: 
 -- stderr: 
 -- stderr: CMake Error: Could not find cmake module file: CMakeRUSTInformation.cmake
 -- stderr: 

See https://cmake.org/cmake/help/v4.0/command/project.html

The most egregious cases are Nasm (which needs to be transformed to `ASM_NASM`) and Rust (which is not yet supported by CMake).

See https://cmake.org/cmake/help/v4.0/command/project.html
@amyspark amyspark requested a review from mensinda as a code owner May 18, 2025 17:41
@nirbheek
Copy link
Member

LGTM, will merge in 24h

@dcbaker dcbaker merged commit 315140f into mesonbuild:master May 23, 2025
31 checks passed
@dcbaker dcbaker added this to the 1.8.1 milestone May 23, 2025
@dcbaker
Copy link
Member

dcbaker commented May 23, 2025

I went ahead and merged this (since it has my review and nirbheek's). I also added it to the 1.8.1 milestone, since it's a bug fix and minimally invasive.

@amyspark amyspark deleted the fix-cmake-compiler-detection-fail branch June 3, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants