Hi all

 

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

 

get-content ConfigureChecks.cmake

| %{$_ -replace "H5_HAVE_TIMEZONE 1","H5_HAVE_TIMEZONE 0"} > xx;move-item
-Force xx ConfigureChecks.cmake

 

(all on 1 line).

 

Unfortunately, Powershell has now converted the file in some other encoding
(I guess UTF-8), which doesn't make sense for the subsequent compilation.

 

Supposing I could resolved that, I have trouble passing this to
PATCH_COMMAND. I tried

 

  ExternalProject_Add(${proj}

   ${${proj}_EP_ARGS}

    .

    PATCH_COMMAND powershell -Command "get-content ConfigureChecks.cmake |
%{$_ -replace \"H5_HAVE_TIMEZONE 1\",\"H5_HAVE_TIMEZONE 0\"} > xx; move-item
-Force xx ConfigureChecks.cmake "

   .

   )

 

But the semi-colon doesn't seem to work

 

2>  Performing patch step for 'HDF5'

2>  ForEach-Object : Cannot bind parameter 'RemainingScripts'. Cannot
convert the "move-item" value of type

2>  "System.String" to type "System.Management.Automation.ScriptBlock".

2>  At line:1 char:50

2>  + ... cks.cmake | %{$_ -replace "H5_HAVE_TIMEZONE 1","H5_HAVE_TIMEZONE
0"}  ...

2>  +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2>      + CategoryInfo          : InvalidArgument: (:) [ForEach-Object],
ParameterBindingException

2>      + FullyQualifiedErrorId :
CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ForEachObjectCo
mmand

 

 

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)

 

    PATCH_COMMAND

      powershell -Command "get-content ConfigureChecks.cmake | %{$_ -replace
\"H5_HAVE_TIMEZONE 1\",\"H5_HAVE_TIMEZONE 0\"} > xx"

      move /Y xx ConfigureChecks.cmake

 

gives almost the same error message (but now with "move" as opposed to
"move-item")

 

Anyone any suggestions?

 

Many thanks

Kris

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to