From 298cdb0c5b1390c0aebfde13162b10e0f9895b06 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 21 Jun 2024 11:56:50 -0500 Subject: [PATCH] Always pass `--target` to `cargo test` when CMake Rust_CARGO_TARGET is set The CMake `cargo test` integration was broken if Rust_CARGO_TARGET were used with `CARGO_FLAGS` set to `-Zbuild-std` (e.g. to target i586 under i686 without the i586 toolchain installed). --- cmake/Tests.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/Tests.cmake b/cmake/Tests.cmake index bc427a39a..d345f1fa1 100644 --- a/cmake/Tests.cmake +++ b/cmake/Tests.cmake @@ -138,6 +138,9 @@ if(DEFINED ASAN) message(FATAL_ERROR "ASAN requires defining the CMake variable Rust_CARGO_TARGET to the intended target triple") endif() +endif() + +if(DEFINED Rust_CARGO_TARGET) list(APPEND cargo_test_flags "--target" ${Rust_CARGO_TARGET}) list(APPEND cargo_test_flags "--lib") endif()