File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -737,8 +737,13 @@ function(_add_cargo_build out_cargo_build_out_dir)
737737 # We set a target folder based on the manifest path so if you build multiple workspaces (or standalone projects
738738 # without workspace) they won't collide if they use a common dependency. This would confuse cargo and trigger
739739 # unnecessary rebuilds
740- string (SHA1 CARGO_TARGET_SUBDIR ${workspace_manifest_path} )
741- set (cargo_target_dir "${CMAKE_BINARY_DIR} /${build_dir} /cargo/build/${CARGO_TARGET_SUBDIR} " )
740+ cmake_path(GET workspace_manifest_path PARENT_PATH parent_path)
741+ cmake_path(GET parent_path PARENT_PATH grandparent_path)
742+ string (REPLACE "${grandparent_path} /" "" cargo_folder_name "${parent_path} " )
743+ string (SHA1 cargo_path_hash ${workspace_manifest_path} )
744+ # Include a hash of the full path in case there are multiple projects with the same folder name
745+ string (SUBSTRING "${cargo_path_hash} " 0 5 cargo_path_hash)
746+ set (cargo_target_dir "${CMAKE_BINARY_DIR} /${build_dir} /cargo/build/${cargo_folder_name} _${cargo_path_hash} " )
742747 set (cargo_build_dir "${cargo_target_dir} /${target_artifact_dir} /${build_type_dir} " )
743748 set ("${out_cargo_build_out_dir} " "${cargo_build_dir} " PARENT_SCOPE)
744749
You can’t perform that action at this time.
0 commit comments