r190613 - [CMake] Put controversial always-recheck-revision-number behind an option.

Jordan Rose jordan_rose at apple.com
Thu Sep 12 09:17:41 PDT 2013


Author: jrose
Date: Thu Sep 12 11:17:41 2013
New Revision: 190613

URL: http://llvm.org/viewvc/llvm-project?rev=190613&view=rev
Log:
[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.

Modified:
    cfe/trunk/CMakeLists.txt
    cfe/trunk/lib/Basic/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=190613&r1=190612&r2=190613&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Sep 12 11:17:41 2013
@@ -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)

Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=190613&r1=190612&r2=190613&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Thu Sep 12 11:17:41 2013
@@ -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()





More information about the cfe-commits mailing list