Run gen-versioninfo unconditionally (#8368)
authorGereon Kremer <gkremer@cs.stanford.edu>
Wed, 23 Mar 2022 08:27:33 +0000 (09:27 +0100)
committerGitHub <noreply@github.com>
Wed, 23 Mar 2022 08:27:33 +0000 (08:27 +0000)
This fixes an issue where the output of `--show-config` would not be updated properly in certain cases (e.g., when files were modified but cmake is not run). We now run the `gen-versioninfo` target unconditionally, always updating the `versioninfo.cpp` where the version data for `--show-config` is stored.

cmake/version.cmake

index 183fe213b7a4c62b9ec7200c545dd1862650826a..87ba19933eb6bf8953751d2ea63e798c5256a823 100644 (file)
@@ -25,19 +25,11 @@ if(CMAKE_SCRIPT_MODE_FILE)
 else()
   # was run within the overall cmake project
   # add target to update versioninfo.cpp at build time
-  add_custom_command(
-    OUTPUT
-      ${CMAKE_BINARY_DIR}/src/base/versioninfo.cpp
+  add_custom_target(gen-versioninfo
     COMMAND ${CMAKE_COMMAND}
       -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
       -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
       -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake
-    DEPENDS
-      ${PROJECT_SOURCE_DIR}/cmake/version-base.cmake
-      ${PROJECT_SOURCE_DIR}/cmake/version.cmake
-  )
-  add_custom_target(gen-versioninfo
-    DEPENDS ${CMAKE_BINARY_DIR}/src/base/versioninfo.cpp
   )
 endif()