I need to create the following always-out-of-date file: ${CMAKE_BINARY_DIR}/version.hpp.in
before any target is executed in the make file. The content of file is exactly as the following:
#define RELEASE_VERSION "${RELEASE}"
#define MAJOR_VERSION "${MAJOR}"
#define MINOR_VERSION "${MINOR}"
#define PATCH_VERSION "${PATCH}"
#define REVISION "${REVISION}"
#define SVNPATH "${SVNPATH}"
I've got the following piece of code in my CMake file, but it's executed only after running the cmake
command:
FILE(WRITE ${CMAKE_BINARY_DIR}/version.hpp.in
"#define RELEASE_VERSION \"${RELEASE}\"\n"
"#define MAJOR_VERSION \"${MAJOR}\"\n"
"#define MINOR_VERSION \"${MINOR}\"\n"
"#define PATCH_VERSION \"${PATCH}\"\n"
"#define REVISION \"${REVISION}\"\n"
"#define SVNPATH \"${SVNPATH}\"\n"
)
I want to generate the version.hpp.in
file each time I run the make
command. How can I do that?