Fix rustup toolchain overrides not working with MSVC

Use the build folder as the working directory for the cargo build so rustup overrides of individual build folders are respected.
This commit is contained in:
Robert Müller 2024-07-03 18:07:41 +02:00
parent 9db780ebbc
commit 4f0ba0d5fa

View file

@ -911,6 +911,7 @@ else()
endif() endif()
endif() endif()
list(APPEND CARGO_BUILD $<$<NOT:$<CONFIG:Debug>>:--release>) list(APPEND CARGO_BUILD $<$<NOT:$<CONFIG:Debug>>:--release>)
list(APPEND CARGO_BUILD --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml")
if(CMAKE_OSX_ARCHITECTURES) if(CMAKE_OSX_ARCHITECTURES)
set(RUST_OSX_ARCHITECTURES) set(RUST_OSX_ARCHITECTURES)
@ -949,7 +950,7 @@ if(NOT CMAKE_OSX_ARCHITECTURES)
add_custom_command( add_custom_command(
OUTPUT ${RUST_OUTPUTS} OUTPUT ${RUST_OUTPUTS}
COMMAND ${CARGO_BUILD} COMMAND ${CARGO_BUILD}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
USES_TERMINAL USES_TERMINAL
DEPENDS ${RUST_SRC} DEPENDS ${RUST_SRC}
) )
@ -982,7 +983,7 @@ else()
add_custom_command( add_custom_command(
OUTPUT ${RUST_OUTPUTS} OUTPUT ${RUST_OUTPUTS}
COMMAND ${CARGO_BUILD} --target=${arch} COMMAND ${CARGO_BUILD} --target=${arch}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
USES_TERMINAL USES_TERMINAL
DEPENDS ${RUST_SRC} DEPENDS ${RUST_SRC}
) )