From 78e269e2515f9dcf51ef4167527a6865aca8447b Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 7 Jan 2014 20:10:39 +0000 Subject: [PATCH] [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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198704 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/CMakeLists.txt | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt index 56c84b8789..43622eb33d 100644 --- a/lib/Basic/CMakeLists.txt +++ b/lib/Basic/CMakeLists.txt @@ -32,17 +32,15 @@ if( NOT IS_SYMLINK "${CLANG_SOURCE_DIR}" ) # See PR 8437 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() -- 2.40.0