]> granicus.if.org Git - clang/commitdiff
[CMake] Put controversial always-recheck-revision-number behind an option.
authorJordan Rose <jordan_rose@apple.com>
Thu, 12 Sep 2013 16:17:41 +0000 (16:17 +0000)
committerJordan Rose <jordan_rose@apple.com>
Thu, 12 Sep 2013 16:17:41 +0000 (16:17 +0000)
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
lib/Basic/CMakeLists.txt

index 69679538f7458a1e8b663f9ca7d124318b6ba533..3d707bce10629fcf9b694e56ce75260135c7410f 100644 (file)
@@ -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)
index 45278ae55d8b390a3c59496eed2bc9bdb18aaf49..4eccfdeee5581818053044f866a67c7c1458896b 100644 (file)
@@ -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()