[CMake] Running shell scripts...

Benjamen R. Meyer bm_witness at yahoo.com
Sun Feb 3 19:16:22 EST 2008


I wrote a bash shell script to get the SVN global revision information
(e-mail me privately if you want a copy) to put into a header file under
POSIX systems. The script is located at ${CMAKE_ROOT}; however, I am
having difficulty getting it to appear in the Makefile. Below is the
syntax from top-most CMakeLists.txt:

IF (WIN32)
        # Execute Win32 Specific commands - none yet.
ELSE (WIN32)
        # Execute commands for other platforms
        ADD_CUSTOM_COMMAND(
                OUTPUT SVN_REVISION
                COMMAND ${CMAKE_ROOT}/getSVNversion.sh
                WORKING_DIRECTORY ${CMAKE_ROOT}
                COMMENT "Creates/updates header SVN Revision Header"
                )
ENDIF (WIN32)

I'd prefer to run it as a pre-build step, but I do not have any targets
specified at the top-most level - which primarily specifies
sub-directories for the tools being built.

The script (getSVNversion.h) does work if I run it from the
command-line. What am I doing wrong above? When I run "cmake" it doesn't
complain about the line, yet I don't have a target in the top-most
Makefile for it either...

or am I mis-understanding something?

TIA,

Ben



More information about the CMake mailing list