r198704 - [cmake] Write Version.inc at cmake time, not at build time.

Nico Weber nicolasweber at gmx.de
Tue Jan 7 12:10:39 PST 2014


Author: nico
Date: Tue Jan  7 14:10:39 2014
New Revision: 198704

URL: http://llvm.org/viewvc/llvm-project?rev=198704&view=rev
Log:
[cmake] Write Version.inc at cmake time, not at build time.

In SVN checkouts, clang_revision_tag is rerun on every build, even if nothing
else is dirty.  After this change, Version.inc is only written at cmake time,
so that empty builds run 0 build steps (like r191784 apparently did for git).

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

Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=198704&r1=198703&r2=198704&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Tue Jan  7 14:10:39 2014
@@ -32,17 +32,15 @@ if( NOT IS_SYMLINK "${CLANG_SOURCE_DIR}"
   find_package(Subversion)
 endif()
 if (Subversion_FOUND AND EXISTS "${CLANG_SOURCE_DIR}/.svn")
-  # Create custom target to generate the Subversion version include.
-  add_custom_target(clang_revision_tag  ALL
-    COMMAND ${CMAKE_COMMAND} -DFIRST_SOURCE_DIR=${LLVM_MAIN_SRC_DIR}
-                             -DFIRST_REPOSITORY=LLVM_REPOSITORY
-                             -DSECOND_SOURCE_DIR=${CLANG_SOURCE_DIR}
-                             -DSECOND_REPOSITORY=SVN_REPOSITORY
-                             -DHEADER_FILE=${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc
-   -P ${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake)
+  set(FIRST_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
+  set(FIRST_REPOSITORY LLVM_REPOSITORY)
+  set(SECOND_SOURCE_DIR ${CLANG_SOURCE_DIR})
+  set(SECOND_REPOSITORY SVN_REPOSITORY)
+  set(HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc)
+  include(GetSVN)
 
   # Mark the generated header as being generated.
-message(STATUS "Expecting header to go in ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
+  message(STATUS "Expecting header to go in ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
   set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc
     PROPERTIES GENERATED TRUE
                HEADER_FILE_ONLY TRUE)
@@ -69,8 +67,3 @@ add_dependencies(clangBasic
   ClangDiagnosticSema
   ClangDiagnosticSerialization
   )
-
-# clangBasic depends on the version.
-if (Subversion_FOUND AND EXISTS "${CLANG_SOURCE_DIR}/.svn")
-  add_dependencies(clangBasic clang_revision_tag)
-endif()





More information about the cfe-commits mailing list