From 013d30ddbbea714fc1488b13522ad1c10c3f9bcd Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Tue, 10 Jan 2023 19:48:21 +0100 Subject: [PATCH] FindRust: Fix trying to find rustup in Quiet mode 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. --- cmake/FindRust.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/FindRust.cmake b/cmake/FindRust.cmake index d7b35db3..0388438f 100644 --- a/cmake/FindRust.cmake +++ b/cmake/FindRust.cmake @@ -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