Files
cmake/Tests/RustOnly/CMakeLists.txt
T
Ayush Singh 5c1b0a6b7e Rust: Add experimental support with Ninja
The TU for Rust is a crate, not per-source.  `rustc` expects entry file
to TU as input, and cannot work with object files.  So we need to have
one-step build/link in most cases, similar to what old Swift was doing.

Issue: #25492
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-02-06 11:32:56 -05:00

15 lines
384 B
CMake

cmake_minimum_required(VERSION 4.2)
set(CMAKE_EXPERIMENTAL_RUST "3cc9b32c-47d3-4056-8953-d74e69fc0d6c")
project(RustOnly LANGUAGES Rust)
add_library(liba STATIC liba.rs)
add_library(libb SHARED libb.rs)
add_library(libc OBJECT libc.rs)
add_executable(RustOnly main.rs)
target_link_libraries(RustOnly liba)
target_link_libraries(RustOnly libb)
target_link_libraries(RustOnly libc)