diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e13dbed..9a5885c77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 #