[CMake] get version number from debian/changelog using cmake?
Christopher Lang
christopher.lang at acurana.de
Tue Jul 1 11:37:33 EDT 2008
Hi,
thanks for the hint. Here is what I made of it (for cmake 2.4). Could be
helpful to somebody else...
# read debian/changelog and parse the version/build number
FILE (READ "${CMAKE_CURRENT_SOURCE_DIR}/debian/changelog" DEBCHANGELOG)
STRING (REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+)"
DEBFULLVERSION "${DEBCHANGELOG}")
STRING (REGEX MATCH "([0-9]+\\.[0-9]+)" DEBMAINVERSION "${DEBFULLVERSION}")
SET(DEBFULLVERSION ${DEBFULLVERSION} CACHE INTERNAL "Full package version."
FORCE)
SET(DEBMAINVERSION ${DEBMAINVERSION} CACHE INTERNAL "Main package version."
FORCE)
# needs to be AFTER the SET commands for version number...
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config.h)
cheers
Chris
http://www.acurana.de/
Am Dienstag 01 Juli 2008 00:03:07 schrieb Mathieu Malaterre:
> On Mon, Jun 30, 2008 at 5:09 PM, Christopher Lang
>
> <christopher.lang at acurana.de> wrote:
> > Hi,
> >
> > is there a good or preferred way to extract the debian version number
> > from debian/changelog to be used in a config.h.cmake file?
>
> I guess STRING(REPLACE...)
>
> You can get fancy in your regex if from cmake you know the name of the
> project...
>
> HTH
More information about the CMake
mailing list