aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-09-01 00:22:26 +0100
committerPeter Wu <peter@lekensteyn.nl>2017-09-01 23:17:24 +0000
commit1ef38667197289f585c7315beacb87179c21b1b6 (patch)
tree7f5c9c16d388cd2cfd4df8893cf730736cff9eb9 /CMakeLists.txt
parente1a591fc746b6d32b68a48b5d80846677ca0fffb (diff)
CMake: prevent unnecessary rebuilds due to version.h
Ninja (but not Unix Makefiles or others) require an explicit BYPRODUCTS command to ensure that the target is executed before evaluating others. Change-Id: Iccbeb2516f7bf22ffdb444f3261ca58d22897891 Reviewed-on: https://code.wireshark.org/review/23342 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'CMakeLists.txt')
-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}