Skip to content

Commit 35d09d5

Browse files
committed
CMake version.cpp: switch back to add_custom_target
Custom commands (per default) only run if the generated file doesn't exist; custom targets always run (but configure_file refrains from actually making a change if not necessary). add_dependencies is still necessary in this case, to note that anything that needs `util` should check `version.cpp`.
1 parent 80331d8 commit 35d09d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/util/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ 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
3535
COMMAND ${CMAKE_COMMAND}
3636
-D CBMC_SOURCE_DIR=${CBMC_SOURCE_DIR}
3737
-D CUR=${CMAKE_CURRENT_BINARY_DIR}
3838
-P ${CMAKE_BINARY_DIR}/version.cmake
39-
)
39+
)
4040

4141
add_library(util
4242
${sources}
4343
version.cpp)
4444

45+
add_dependencies(util generate_version_cpp)
46+
4547
generic_includes(util)
4648

4749
target_link_libraries(util big-int langapi)

0 commit comments

Comments
 (0)