Here is the code: find_file(myproject_BUILD_NUMBER_FILE_FOUND myproject_build_number.txt PATHS ${myproject_SOURCE_DIR})
if(${myproject_BUILD_NUMBER_FILE_FOUND} MATCHES "NOTFOUND") set(myproject_CURRENT_BUILD_NUM 1) else() file(READ ${myproject_SOURCE_DIR}/myproject_build_number.txt OLD_BUILD_NUM) if(BUILD_VERSION) math(EXPR myproject_CURRENT_BUILD_NUM "${OLD_BUILD_NUM} + 1") file(WRITE ${myproject_SOURCE_DIR}/myproject_build_number.txt "${myproject_CURRENT_BUILD_NUM}") else() set(myproject_CURRENT_BUILD_NUM ${OLD_BUILD_NUM}) endif() endif() configure_file(${myproject_SOURCE_DIR}/version/myproject_version.h.in ${myproject_SOURCE_DIR}/version/myproject_version.h @ONLY) -- BG, Alexey _______________________________________________ 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