[Cmake] howto increment build number with cmake
Michael T. Wagner
Michael T. Wagner" <mtw at shared-reality.com
Mon, 26 Jan 2004 13:56:38 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0049_01C3E414.37EFFF20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi there,
I've found out myself - I've added a ADD_CUSTOM_COMMAND with a little =
python script to parse and increment the build number in the source =
file.=20
To make sure it gets called on every build I've put the array containing =
all source files as DEPENDS field.=20
It looks like this:
SET (SRM_SRC ...blabla. ) # all source files=20
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_SOURCE_DIR}/Version.cpp
DEPENDS ${SRM_SRC}
COMMAND ${PYTHON} # the python interpreter=20
ARGS ${PROJECT_SOURCE_DIR}/IncVer.py # increments build no in =
Version.cpp
)=20
Greetings,
Mike
----- Original Message -----=20
From: Michael T. Wagner=20
To: cmake at www.cmake.org=20
Sent: Monday, January 12, 2004 5:03 PM
Subject: [Cmake] howto increment build number with cmake
Hi to the list,
I'm trying to use cmake to increment a build number in the source code =
on each make.=20
I've looked into the CONFIGURE_FILE command but didnt find a solution =
since it just replaces cmake variables.=20
I'm using cmake on WIN32 with vs.net 2003.
Any clues ?=20
Thanks in advance,
Michael=20
------=_NextPart_000_0049_01C3E414.37EFFF20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Hi there,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I've found out myself - I've added a=20
ADD_CUSTOM_COMMAND with a little python script to parse and increment =
the build=20
number in the source file. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>To make sure it gets called on =
every build=20
I've put the array containing all source files as DEPENDS field.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>It looks like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<P><FONT size=3D2>SET (SRM_SRC ...blabla. ) # all source files =
</FONT></P>
<P><FONT size=3D2>ADD_CUSTOM_COMMAND(</FONT></P>
<P><FONT size=3D2>OUTPUT ${PROJECT_SOURCE_DIR}/Version.cpp</FONT></P>
<P><FONT size=3D2>DEPENDS ${SRM_SRC}</FONT></P>
<P><FONT size=3D2>COMMAND ${PYTHON} # the python =
interpreter=20
</FONT></P>
<P><FONT size=3D2>ARGS =
${PROJECT_SOURCE_DIR}/IncVer.py =20
# increments build no in Version.cpp</FONT></P>
<P><FONT size=3D2></FONT></P>
<P><FONT size=3D2>) </FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2>Greetings,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Mike</FONT></DIV></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3Dmtw at shared-reality.com =
href=3D"mailto:mtw at shared-reality.com">Michael=20
T. Wagner</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dcmake at www.cmake.org=20
href=3D"mailto:cmake at www.cmake.org">cmake at www.cmake.org</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, January 12, 2004 =
5:03=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Cmake] howto =
increment build=20
number with cmake</DIV>
<DIV><BR></DIV>
<DIV><FONT face=3DArial size=3D2>Hi to the list,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm trying to use cmake to increment =
a build=20
number in the source code on each make. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I've looked into the CONFIGURE_FILE =
command but=20
didnt find a solution since it just replaces cmake variables. =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm using cmake on WIN32 with vs.net=20
2003.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Any clues ? </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Michael </FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2></FONT> </DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0049_01C3E414.37EFFF20--