From 6c4b920f0a9762890a63c76627f686adcf4ef8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 12 Jul 2024 22:26:03 +0200 Subject: [PATCH] Fix `--manifest-path` argument usage for Android build Whereas `cargo` expects the `--manifest-path` argument after the `build` command, `cargo ndk` only supports arguments being specified before the `build` command, which was causing the Android build to fail with: ``` error: Failed loading manifest error: No such file or directory (os error 2) ``` Regression from #8557. --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a7c80860..7d872d19a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -871,11 +871,11 @@ list(APPEND TARGETS_OWN rust-bridge-shared) if(TARGET_OS STREQUAL "android") set(CARGO_BUILD_DIR "${CARGO_NDK_TARGET}/") - set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} ndk -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} build) + set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} ndk --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml" -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} build) set(CARGO_TEST ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} ${RUST_CARGO} ndk -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} test) else() set(CARGO_BUILD_DIR "") - set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} build) + set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} build --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml") set(CARGO_TEST ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} ${RUST_CARGO} test) endif() if(MSVC) @@ -911,7 +911,6 @@ else() endif() endif() list(APPEND CARGO_BUILD $<$>:--release>) -list(APPEND CARGO_BUILD --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml") if(CMAKE_OSX_ARCHITECTURES) set(RUST_OSX_ARCHITECTURES)