[CMake] EXECUTE_PROCESS problem

Richard Wackerbarth richard at nfsnet.org
Tue May 15 14:17:14 EDT 2007


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



More information about the CMake mailing list