diff --git a/README.md b/README.md index a0f1ddfa..05fec65e 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,21 @@ The pairs can also be generator expressions, as they will be evaluated using $= 3.19.0. +#### Information provided by Corrosion + +For your convenience, Corrosion sets a number of variables which contain information about the version of the rust +toolchain. You can use the CMake version comparison operators +(e.g. [`VERSION_GREATER_EQUAL`](https://cmake.org/cmake/help/latest/command/if.html#version-comparisons)) on the main +variable (e.g. `if(Rust_VERSION VERSION_GREATER_EQUAL "1.57.0")`), or you can inspect the major, minor and patch +versions individually. +- `Rust_VERSION<_MAJOR|_MINOR|_PATCH>` - The version of rustc. +- `Rust_CARGO_VERSION<_MAJOR|_MINOR|_PATCH>` - The cargo version. +- `Rust_LLVM_VERSION<_MAJOR|_MINOR|_PATCH>` - The LLVM version used by rustc. +- `Rust_IS_NIGHTLY` - 1 if a nightly toolchain is used, otherwise 0. Useful for selecting an unstable feature for a + crate, that is only available on nightly toolchains. + +### Cargo feature selection + Cargo crates sometimes offer features, which traditionally can be specified with `cargo build` on the command line as opt-in. You can select the features to enable with the `FEATURES` argument when calling `corrosion_import_crate`. The following example enables the "chocolate" and "vanilla" @@ -172,6 +187,7 @@ parameters for `corrosion_import_crate` called `ALL_FEATURES` and `NO_DEFAULT_FE boolean target properties - which override any specified values with `corrosion_import_crate` are called `CORROSION_ALL_FEATURES` and `CORROSION_NO_DEFAULT_FEATURES`. + ### Developer/Maintainer Options These options are not used in the course of normal Corrosion usage, but are used to configure how Corrosion is built and installed. Only applies to Corrosion builds and subdirectory uses. diff --git a/cmake/FindRust.cmake b/cmake/FindRust.cmake index 7029f3be..2e5e0d5e 100644 --- a/cmake/FindRust.cmake +++ b/cmake/FindRust.cmake @@ -108,7 +108,7 @@ if (_RESOLVE_RUSTUP_TOOLCHAINS) set(_TOOLCHAIN_OVERRIDE ${_TOOLCHAIN}) endif() else() - message(WARNING "Didn't reconize toolchain: ${_TOOLCHAIN_RAW}") + message(WARNING "Didn't recognize toolchain: ${_TOOLCHAIN_RAW}") endif() endforeach() @@ -158,7 +158,7 @@ if (_RESOLVE_RUSTUP_TOOLCHAINS) message(VERBOSE "Rust toolchain ${_RUSTUP_TOOLCHAIN_FULL}") message(VERBOSE "Rust toolchain path ${_RUST_TOOLCHAIN_PATH}") - # Is overrided if the user specifies `Rust_COMPILER` explicitly. + # Is overridden if the user specifies `Rust_COMPILER` explicitly. find_program( Rust_COMPILER_CACHED rustc