[CMake] EXECUTE_PROCESS problem

2007-05-15 Thread Ajay Divekar
I am trying to execute a script which calculates checksum of the binary files 
created during install process.

the script is as follows

#!/bin/sh

IF(UNIX)
  SET(CHKSUM "/sbin/sha1 -r")
ELSE(UNIX)
  SET(CHKSUM "/usr/bin/sha1sum")
ENDIF(UNIX)

EXECUTE_PROCESS( COMMAND ${CHKSUM} $ENV{PP_ROOTDIR}/bin/PSWd OUTPUT_FILE 
CHECKSUM.txt )

The above execute_program command does not work but if I replace it with (on 
unix synstems)
EXECUTE_PROCESS( COMMAND /sbin/sha1 -r  bin/PSWd OUTPUT_FILE CHECKSUM.txt)
it works.

This leads me to believe that EXECUTE_PROCESS command does not take variables. 
Is this true? and if it is what would be the solution to calculating checksum 
on different platforms?

Regards,
-- 
Ajay Divekar
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] EXECUTE_PROCESS problem

2007-05-15 Thread Richard Wackerbarth
I'm not sure, but I think that, in the UNIX case, your executable is  
not "sha1", but rather it is looking for the filename "sha1 -r".

Try

IF(UNIX)
  SET(CHKSUM_EXECUTABLE "/sbin/sha1")
  SET(CHKSUM_PARAMETERS  "-r")
ELSE(UNIX)
  SET(CHKSUM_EXECUTABLE "/usr/bin/sha1sum")
  SET(CHKSUM_PARAMETERS  ""
ENDIF(UNIX)

EXECUTE_PROCESS( COMMAND ${CHKSUM_EXECUTABLE} ${CHKSUM_PARAMETERS}  
$ENV{PP_ROOTDIR}/bin/PSWd OUTPUT_FILE

CHECKSUM.txt )

Although it won't affect the interpretation, note that this is not  
the appropriate syntax for

#!/bin/sh


Perhaps that line should be something else.

Richard

On May 15, 2007, at 11:38 AM, Ajay Divekar wrote:

I am trying to execute a script which calculates checksum of the  
binary files

created during install process.

the script is as follows

#!/bin/sh

IF(UNIX)
  SET(CHKSUM "/sbin/sha1 -r")
ELSE(UNIX)
  SET(CHKSUM "/usr/bin/sha1sum")
ENDIF(UNIX)

EXECUTE_PROCESS( COMMAND ${CHKSUM} $ENV{PP_ROOTDIR}/bin/PSWd  
OUTPUT_FILE

CHECKSUM.txt )

The above execute_program command does not work but if I replace it  
with (on

unix synstems)
EXECUTE_PROCESS( COMMAND /sbin/sha1 -r  bin/PSWd OUTPUT_FILE  
CHECKSUM.txt)

it works.

This leads me to believe that EXECUTE_PROCESS command does not take  
variables.
Is this true? and if it is what would be the solution to  
calculating checksum

on different platforms?

Regards,
--
Ajay Divekar


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake