[CMake] install(CODE "execute_process(COMMAND perl script.pl) and output to file

David Cole david.cole at kitware.com
Mon Jun 8 11:08:28 EDT 2009


Maybe try the explicit three argument form of the perl open function instead
of the magic two argument form....?
i.e. :
open( FILEHANDLE, ">", "file.txt" ) ......


HTH,
David


On Mon, Jun 8, 2009 at 10:37 AM, Pierre-Julien Villoud
<PVilloud at movea.com>wrote:

>  Hi,
>
>
>
> I am using some perl scripts to complete tasks in the install target. I
> have no problem launching the script , but I found myself with non working
> code inside the script and I don’t why.
>
>
>
> Inside my script I do that:
>
> open( FILEHANDLE, ">file.txt" ) || die("Could not open file!");
>
> print "opening uninstfile $uninstfile\n";
>
> print FILEHANDLE "I need to print this in the file\n";
>
> close(FILEHANDLE);
>
>
>
>
>
> This code works if I launch the script from the command line, but fails
> from within cmake
>
> The handle opens the file but never prints to it. I suppose there is a
> problem with a redirection, but I don’t know what.
>
> I really need a solution for that as my script needs to work inside and
> outside cmake.
>
>
>
> Anyone can help?
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090608/293ce999/attachment.htm>


More information about the CMake mailing list