CMake does not have the ability to perform actions before calculating
dependencies, so it can't know whether it needs to rebuild clangBasic
to update for a new revision number. CLANG_ALWAYS_CHECK_VC_REV (off by
default) will cause clangBasic to always be dirty by deleting the
generated SVNVersion.inc after use; otherwise, SVNVersion.inc will
always be updated, but only included in the final binary when clangBasic
is rebuilt.
It'd be great to find a better way to do this, but hopefully this is
still an improvement over the complete lack of version information before.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190613
91177308-0d34-0410-b5e6-
96231b3b80d8
"Version number that will be placed into the libclang library , in the form XX.YY")
mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
+option(CLANG_ALWAYS_CHECK_VC_REV "Always keep revision number up-to-date." OFF)
+
add_subdirectory(utils/TableGen)
add_subdirectory(include)
clang_revision_tag
)
-add_custom_command(TARGET clangBasic POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc)
+# Force regeneration now.
+FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc)
+
+if(CLANG_ALWAYS_CHECK_VC_REV)
+ add_custom_command(TARGET clangBasic POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E remove
+ ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc)
+endif()