Skip to content

Commit

Permalink
CMake+Rust: Fix offline builds w. vendored git repos
Browse files Browse the repository at this point in the history
Some builds using the tarball with the vendored Rust dependencies are
failing.

The onenote-rs dependency is presently tied to a git branch from github
rather than using a release from crates.io. This is the differing factor
though I'm unsure why it is causing the build to try to update the repo
rather than just building the vendored source.

This commit adds a `--offline` parameter to the build options if the
vendored source is detected, in an attempt to force Cargo to use what it
has and stay offline.
  • Loading branch information
micahsnyder committed Dec 19, 2023
1 parent 2178e4a commit 8228bd9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/FindRust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ endif()

set(CARGO_ARGS "build")

if(EXISTS "${ARGS_SOURCE_DIRECTORY}/.cargo/vendor")
list(APPEND CARGO_ARGS "--offline")
endif()

if(NOT "${RUST_COMPILER_TARGET}" MATCHES "^universal-apple-darwin$")
# Don't specify the target for macOS universal builds, we'll do that manually for each build.
list(APPEND CARGO_ARGS "--target" ${RUST_COMPILER_TARGET})
Expand Down

0 comments on commit 8228bd9

Please sign in to comment.