Skip to content

Commit

Permalink
Quote the list of patch files in case they have spaces in their paths (
Browse files Browse the repository at this point in the history
…#463)

The rapids cpm scripts fail when populating a dependency with patches if the build directory contains spaces in its path name. The reason is because the paths are not properly quoted in the cmake patch script generated from `command_template.cmake.in`.

This PR properly quotes the list of patch file names.

Authors:
  - Eric Niebler (https://github.com/ericniebler)
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #463
  • Loading branch information
ericniebler authored Sep 26, 2023
1 parent 59328e3 commit f51861e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rapids-cmake/cpm/patches/command_template.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function(rapids_cpm_run_git_patch file issue)
set(msg_state ${msg_state} PARENT_SCOPE)
endfunction()

set(files @patch_files_to_run@)
set(files "@patch_files_to_run@")
set(issues "@patch_issues_to_ref@")
set(output_file "@log_file@")
foreach(file issue IN ZIP_LISTS files issues)
Expand Down
9 changes: 7 additions & 2 deletions testing/cpm/cpm_generate_patch_command-current_json_dir.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2022, NVIDIA CORPORATION.
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,6 +38,11 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json
"file" : "${current_json_dir}/example.diff",
"issue" : "explain",
"fixed_in" : ""
},
{
"file" : "${current_json_dir}/example2.diff",
"issue" : "explain",
"fixed_in" : ""
}
]
}
Expand All @@ -51,7 +56,7 @@ if(NOT patch_command)
message(FATAL_ERROR "rapids_cpm_package_override specified a patch step for `pkg_with_patch`")
endif()

set(to_match_string "set(files ${CMAKE_CURRENT_BINARY_DIR}/example.diff)")
set(to_match_string "set(files \"${CMAKE_CURRENT_BINARY_DIR}/example.diff;${CMAKE_CURRENT_BINARY_DIR}/example2.diff\")")

list(POP_BACK patch_command script_to_run)
file(READ "${script_to_run}" contents)
Expand Down

0 comments on commit f51861e

Please sign in to comment.