Hi,

I'm trying to get some svn information into a build of a C library.

The cmake currently looks like this (gathered from various posts)

INCLUDE(FindSubversion)
IF(SUBVERSION_FOUND)
    Subversion_WC_INFO(${PROJECT_SOURCE_DIR} rr)
    Subversion_WC_LOG(${PROJECT_SOURCE_DIR} rr)

    SET(infoFile rr_svn_info)

    FILE(WRITE ${infoFile}.txt
"#ifndef ${infoFile}H
#define ${infoFile}H
const int SVN_VERSION =  ${rr_WC_REVISION};\n
const char* SVN_LAST_COMMIT_AUTHOR =\"${rr_WC_LAST_CHANGED_AUTHOR}\";\n
const char* SVN_LASTLOG =\"    ${rr_LAST_CHANGED_LOG}\";\n
#endif"
    )

EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${infoFile}.txt ${infoFile}.h)
ENDIF(SUBVERSION_FOUND)


Currently I have two problems:
When generating the header, the svn_lastlog expands to something like

const char* SVN_LASTLOG =" ------------------------------------------------------------------------
r505 | tottek | 2012-06-28 14:11:49 -0700 (Thu, 28 Jun 2012) | 20 lines

New release
..... etc..

The above will not compile, because a string spanning multiple lines in C must have a continuation character at the end of each line, e.g.

const char* SVN_LASTLOG ="\ ------------------------------------------------------------------------\
r505 | tottek | 2012-06-28 14:11:49 -0700 (Thu, 28 Jun 2012) | 20 lines\
.... etc...

How would one solve that in CMake?

The second problem is the execute process command
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${infoFile}.txt ${infoFile}.h)

which do create the txt file, but fails to copy it to the .h file. Just getting an error saying
Error copying file (if different) from "the txt file" to "the h file"

Any tips?

-totte

--
.........................
Totte Karlsson, Ph.D.
Dune Scientific, LLC
425-296 1980 (office)
425-780 9648 (cell)
www.dunescientific.com
.........................


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to