Rust_EMITΒΆ
Added in version 4.4.
Note
Experimental. Gated by CMAKE_EXPERIMENTAL_RUST.
This property controls the type of output generated by the Rust compiler. Can be one of several values:
linkThis is the default if the property is not set. The crate will be compiled into an rlib file, e.g.:
libfile.rs.rlibNote
CMake will automatically prefix the generated
rlibfile withlibas the Rust compiler always requires such a prefix for external crates.objGenerate a native object file, e.g.:
file.rs.oasmGenerate an assembly file, e.g.:
file.rs.s
Note
The obj and asm output types are known to have the following
limitations:
When enabled, the Rust compiler disables multiple codegen units and ThinLTO. Depending on the situation, this can affect the generated code, optimizations. It also reduce the internal parallelism inside and the compiler and can reduce the effectiveness of incremental rebuilds.
The generated
objfiles cannot be used as external crates, so other Rust code can only use C-style API from them.The generated
objfiles cannot be linked as-is with native linkers, additional crates from the Rust toolchain needs to linked too. The actual crates to link depend on the code and compiler options.