Skip to content

Commit 9a2a7c2

Browse files
committed
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.
1 parent 6a10f1a commit 9a2a7c2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/util/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ endif()
3030

3131
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.cpp.in
3232
"const char *CBMC_VERSION=\"@CBMC_RELEASE@ (@GIT_INFO@)\";\n")
33-
add_custom_command(
34-
OUTPUT version.cpp
33+
add_custom_target(
34+
generate_version_cpp
35+
BYPRODUCTS version.cpp
3536
COMMAND ${CMAKE_COMMAND}
3637
-D CBMC_SOURCE_DIR=${CBMC_SOURCE_DIR}
3738
-D CUR=${CMAKE_CURRENT_BINARY_DIR}
@@ -42,6 +43,8 @@ add_library(util
4243
${sources}
4344
version.cpp)
4445

46+
add_dependencies(util generate_version_cpp)
47+
4548
generic_includes(util)
4649

4750
target_link_libraries(util big-int langapi)

0 commit comments

Comments
 (0)