Skip to content

Commit

Permalink
Ensure build directory contains a copy of rust-toolchain.toml.
Browse files Browse the repository at this point in the history
When building using cargo's --manifest-path option the toolchain configuration file within the manifest directory is ignored. Ensuring a copy of the rust-toolchain.toml file is in the build directory ensures the toolchain settings are pciked up when building via cmake.
  • Loading branch information
gmartin82 committed Aug 22, 2024
1 parent 6e67b83 commit d79b2b5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ else()
configure_cargo_toml(${cargo_toml_dir_release} ${project_version} ${cargo_lib_name_release})
endif()

#
# Copy toolchain configuration to build directory to ensure it is used when cargo is invoked from a directory other
# than the directory containing the manifest file
#
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/rust-toolchain.toml")
file(COPY
${CMAKE_CURRENT_SOURCE_DIR}/rust-toolchain.toml
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()

#
# Configure result library names
#
Expand Down

0 comments on commit d79b2b5

Please sign in to comment.