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.
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()