All: Only update version info if needed
Jeffrey Pfau jeffrey@endrift.com
Mon, 19 Sep 2016 19:49:58 -0700
3 files changed,
11 insertions(+),
3 deletions(-)
M
CMakeLists.txt
→
CMakeLists.txt
@@ -122,7 +122,7 @@ endforeach()
endfunction() # Version information -add_custom_target(version-info ALL ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/src/core/version.c.in +add_custom_target(version-info ALL COMMAND ${CMAKE_COMMAND} -DBINARY_NAME=${BINARY_NAME} -DCONFIG_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/core/version.c.in
M
version.cmake
→
version.cmake
@@ -43,6 +43,10 @@ if(NOT GIT_BRANCH)
set(GIT_BRANCH "(unknown)") endif() -if(CONFIG_FILE AND OUT_FILE) - configure_file("${CONFIG_FILE}" "${OUT_FILE}") +if(NOT VERSION_STRING_CACHE OR NOT VERSION_STRING STREQUAL VERSION_STRING_CACHE) + set(VERSION_STRING_CACHE ${VERSION_STRING} CACHE STRING "" FORCE) + + if(CONFIG_FILE AND OUT_FILE) + configure_file("${CONFIG_FILE}" "${OUT_FILE}") + endif() endif()