mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-11-30 14:44:33 -06:00
CMake 4.4 can build Rust, so a Rust tree can be driven by CMake as well as by Cargo. Two things are needed from us and both are the ordinary spellings: CMAKE_Rust_COMPILER, because CMake looks for a C or C++ compiler by itself but has nowhere to look for the one that was selected here, and CMAKE_Rust_FLAGS, there being no environment variable it reads for a language's flags the way it reads CFLAGS. The support is experimental, which in CMake's terms means a project has to name an activation value before `project(... LANGUAGES Rust)` will configure. That value changes between releases of CMake by design, so it belongs in the CMakeLists.txt of whoever is asking rather than anywhere in here. Nothing keeps a Rust compiler CMake cannot drive from being tried: gccrs and mrustc both answer `Unknown option '--print'` to the first thing CMake asks them, which says what happened better than a list in here would, and does not go stale as they gain the ability. Libraries are not wired up: getIncludeArguments names rlibs relative to the project root and CMake builds a directory below it, so the Libraries pane needs absolute paths before it would work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>