From 17e95c8aac18cac3e040079a120b4a129975ae9d Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Thu, 12 Sep 2013 16:17:41 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190613 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 2 ++ lib/Basic/CMakeLists.txt | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69679538f7..3d707bce10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt index 45278ae55d..4eccfdeee5 100644 --- a/lib/Basic/CMakeLists.txt +++ b/lib/Basic/CMakeLists.txt @@ -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() -- 2.50.1