From f51861eaa6e2ddcd75075074eb54b23b49052e5a Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 26 Sep 2023 11:39:15 -0700 Subject: [PATCH] Quote the list of patch files in case they have spaces in their paths (#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: https://github.com/rapidsai/rapids-cmake/pull/463 --- rapids-cmake/cpm/patches/command_template.cmake.in | 2 +- .../cpm_generate_patch_command-current_json_dir.cmake | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rapids-cmake/cpm/patches/command_template.cmake.in b/rapids-cmake/cpm/patches/command_template.cmake.in index 8f5393b0..76980b9e 100644 --- a/rapids-cmake/cpm/patches/command_template.cmake.in +++ b/rapids-cmake/cpm/patches/command_template.cmake.in @@ -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) diff --git a/testing/cpm/cpm_generate_patch_command-current_json_dir.cmake b/testing/cpm/cpm_generate_patch_command-current_json_dir.cmake index 5d77d8f1..5cb74788 100644 --- a/testing/cpm/cpm_generate_patch_command-current_json_dir.cmake +++ b/testing/cpm/cpm_generate_patch_command-current_json_dir.cmake @@ -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. @@ -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" : "" } ] } @@ -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)