forked from OSchip/llvm-project
[CMake] Put controversial always-recheck-revision-number behind an option.
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. llvm-svn: 190613
This commit is contained in:
parent
d6d1b52937
commit
f31f5f8488
|
@ -321,6 +321,8 @@ set(LIBCLANG_LIBRARY_VERSION
|
|||
"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)
|
||||
|
|
|
@ -59,5 +59,11 @@ add_dependencies(clangBasic
|
|||
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()
|
||||
|
|
Loading…
Reference in New Issue