Skip to content

Commit

Permalink
FindRust: Fix trying to find rustup in Quiet mode
Browse files Browse the repository at this point in the history
If Rust_TOOLCHAIN is defined and the QUIET argument was given but
`rustup` was not able to be found corrosion would still try to discover
rustup toolchains. This commits corrects this behaviour.
  • Loading branch information
jschwe committed Jan 10, 2023
1 parent 58d979b commit 013d30d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmake/FindRust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ endif()
if (DEFINED Rust_TOOLCHAIN)
# If the user specifies `Rust_TOOLCHAIN`, then look for `rustup` first, rather than `rustc`.
find_program(Rust_RUSTUP rustup PATHS "$ENV{HOME}/.cargo/bin")
if (NOT Rust_RUSTUP AND NOT "${Rust_FIND_QUIETLY}")
message(
WARNING "CMake variable `Rust_TOOLCHAIN` specified, but `rustup` was not found. "
"Ignoring toolchain and looking for a Rust toolchain not managed by rustup.")
else()
if(Rust_RUSTUP)
set(_RESOLVE_RUSTUP_TOOLCHAINS ON)
else()
set(_RESOLVE_RUSTUP_TOOLCHAINS OFF)
if(NOT "${Rust_FIND_QUIETLY}")
message(
WARNING "CMake variable `Rust_TOOLCHAIN` specified, but `rustup` was not found. "
"Ignoring toolchain and looking for a Rust toolchain not managed by rustup.")
endif()
endif()
else()
# If we aren't definitely using a rustup toolchain, look for rustc first - the user may have
Expand Down

0 comments on commit 013d30d

Please sign in to comment.