Open
Description
In CI environments, whenever my CPMAddPackage
command
has PATCHES
set with multiple files, I get an error
/usr/bin/patch: '&&': extra operand
/usr/bin/patch: Try '/usr/bin/patch --help' for more information.
This occurs because in function cpm_add_patches
, the patch command is built by concatenating
a bunch of strings like
patch -p1 < "$first_patch_file" && patch -p1 < "$second_patch_file"
And then these strings are appended to the PATCH_COMMAND
argument for hand-off to a downstream function (FetchContent?).
This assumes that the PATCH_COMMAND
executor is a shell that understands things like &&
, which apparently is not always the case.
After looking at CMake docs, I hacked together a basic workaround which appears to work. CMake apparently allows issuing multiple commands for the PATCH_COMMAND
as long as you declare COMMAND
for each subsequent command after the first:
PATCH_COMMAND
patch -p1 -i $first_patch
COMMAND patch -p1 -i $second_aptch
```
Metadata
Metadata
Assignees
Labels
No labels
Activity