aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c0fb227b4..cfd4df9457 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1462,7 +1462,15 @@ if (${GIT_EXECUTABLE})
set(GIT_BIN_PARAM "--git-bin ${GIT_EXECUTABLE}")
endif()
set( VERSION ${PROJECT_VERSION} )
+if(NOT CMAKE_VERSION VERSION_LESS "3.2.1")
+ # Prevents unnecessary rebuilds by ensuring that dependents are not
+ # built before make-version.pl finishes (which may touch version.h).
+ set(version_byproducts BYPRODUCTS version.h)
+else()
+ set(version_byproducts "")
+endif()
add_custom_target(version
+ ${version_byproducts}
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/make-version.pl
--set-vcs ${GIT_BIN_PARAM}