mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
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>
15 lines
384 B
CMake
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)
|