From 9a2a7c240f2e659ff4bc1717747f1bc55ebcf7c1 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 1 Aug 2018 17:22:45 +0100 Subject: [PATCH] Switch version.cpp from a rule product to a byproduct As a rule product it will only be created once; as a byproduct the target will always be executed, resulting in version.cpp being regenerated when additional commits are made, and yet util.a will correctly be sequenced behind it. This corrects the reverted PR #2657, which did not note version.cpp as a byproduct (hence a generated file), which meant version.cpp would be disregarded as a missing source file on the initial build. --- src/util/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 2100c47a543..4ae6f1ff10f 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -30,8 +30,9 @@ endif() file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.cpp.in "const char *CBMC_VERSION=\"@CBMC_RELEASE@ (@GIT_INFO@)\";\n") -add_custom_command( - OUTPUT version.cpp +add_custom_target( + generate_version_cpp + BYPRODUCTS version.cpp COMMAND ${CMAKE_COMMAND} -D CBMC_SOURCE_DIR=${CBMC_SOURCE_DIR} -D CUR=${CMAKE_CURRENT_BINARY_DIR} @@ -42,6 +43,8 @@ add_library(util ${sources} version.cpp) +add_dependencies(util generate_version_cpp) + generic_includes(util) target_link_libraries(util big-int langapi)