<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi all<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I have a superbuild project where I need to patch a library (HDF5) after download. In Windows, there’s no “patch” or “sed” command, and this has to run on other people’s computer. I can almost achieve what I want in Powershell like so<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>get-content ConfigureChecks.cmake<o:p></o:p></p><p class=MsoNormal>| %{$_ -replace "H5_HAVE_TIMEZONE 1","H5_HAVE_TIMEZONE 0"} > xx;move-item -Force xx ConfigureChecks.cmake<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>(all on 1 line).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Unfortunately, Powershell has now converted the file in some other encoding (I guess UTF-8), which doesn’t make sense for the subsequent compilation.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Supposing I could resolved that, I have trouble passing this to PATCH_COMMAND. I tried<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> ExternalProject_Add(${proj}<o:p></o:p></p><p class=MsoNormal> ${${proj}_EP_ARGS}<o:p></o:p></p><p class=MsoNormal> …<o:p></o:p></p><p class=MsoNormal> PATCH_COMMAND powershell -Command “get-content ConfigureChecks.cmake | %{$_ -replace \"H5_HAVE_TIMEZONE 1\",\"H5_HAVE_TIMEZONE 0\"} > xx; move-item -Force xx ConfigureChecks.cmake “<o:p></o:p></p><p class=MsoNormal> …<o:p></o:p></p><p class=MsoNormal> )<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>But the semi-colon doesn’t seem to work<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> Performing patch step for 'HDF5'<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> ForEach-Object : Cannot bind parameter 'RemainingScripts'. Cannot convert the "move-item" value of type<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> "System.String" to type "System.Management.Automation.ScriptBlock".<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> At line:1 char:50<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> + ... cks.cmake | %{$_ -replace "H5_HAVE_TIMEZONE 1","H5_HAVE_TIMEZONE 0"} ...<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> + CategoryInfo : InvalidArgument: (:) [ForEach-Object], ParameterBindingException<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'>2> + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ForEachObjectCommand<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Trying to split it up as 2 commands (for instance the first powershell and the next cmd, but I could have used powershell as well)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> PATCH_COMMAND<o:p></o:p></p><p class=MsoNormal> powershell -Command "get-content ConfigureChecks.cmake | %{$_ -replace \"H5_HAVE_TIMEZONE 1\",\"H5_HAVE_TIMEZONE 0\"} > xx"<o:p></o:p></p><p class=MsoNormal> move /Y xx ConfigureChecks.cmake<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>gives almost the same error message (but now with “move” as opposed to “move-item”)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Anyone any suggestions?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Many thanks<o:p></o:p></p><p class=MsoNormal>Kris<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p></div></body></html>