[CMake] Building a Version Header

John Drescher drescherjm at gmail.com
Wed Jul 7 22:58:42 EDT 2010


> 1) I'm using git

I know. You have some work to do..
On top of the minor differences in what you want the FindGIt.cmake
does not have that option to return the version so you need to adapt
it to get the git version similar to the way the FindSubversion.cmake
module does for subversion repositories.

> 2) If it outputs to the build directory, how do I refer to it?

You can include files from your build folder in your project.

Just add
include_directories(${PROJECT_BINARY_DIR})

in your CMakeLists.txt

then use the header as you would any other header in your project.
John


More information about the CMake mailing list