Index: cmake/modules/GenerateVersionFromCVS.cmake =================================================================== --- cmake/modules/GenerateVersionFromCVS.cmake +++ cmake/modules/GenerateVersionFromCVS.cmake @@ -8,7 +8,7 @@ # and SECOND_REPOSITORY and SECOND_REVISION if requested, where "FIRST" and # "SECOND" are substituted with the names specified in the input variables. - +if (LLVM_APPEND_VC_REV) # Chop off cmake/modules/GetSVN.cmake get_filename_component(LLVM_DIR "${CMAKE_SCRIPT_MODE_FILE}" PATH) @@ -32,6 +32,11 @@ append_info(${NAME} "${SOURCE_DIR}") +else() + file(WRITE "${HEADER_FILE}.txt" "") +endif() + + # Copy the file only if it has changed. execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HEADER_FILE}.txt" "${HEADER_FILE}") Index: include/llvm/Support/CMakeLists.txt =================================================================== --- include/llvm/Support/CMakeLists.txt +++ include/llvm/Support/CMakeLists.txt @@ -9,7 +9,6 @@ endfunction() macro(find_first_existing_vc_file out_var path) - if ( LLVM_APPEND_VC_REV ) find_program(git_executable NAMES git git.exe git.cmd) # Run from a subdirectory to force git to print an absolute path. execute_process(COMMAND ${git_executable} rev-parse --git-dir @@ -30,7 +29,6 @@ "${path}/.svn/entries" # SVN 1.6 ) endif() - endif() endmacro() find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}") @@ -40,22 +38,21 @@ set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake") -if(DEFINED llvm_vc) - # Create custom target to generate the VC revision include. - add_custom_command(OUTPUT "${version_inc}" - DEPENDS "${llvm_vc}" "${get_svn_script}" - COMMAND - ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}" - "-DNAME=LLVM_REVISION" - "-DHEADER_FILE=${version_inc}" - -P "${get_svn_script}") - - # Mark the generated header as being generated. - set_source_files_properties("${version_inc}" - PROPERTIES GENERATED TRUE - HEADER_FILE_ONLY TRUE) -else() - file(WRITE "${version_inc}" "") -endif() +add_custom_command(OUTPUT force_version_inc_check COMMAND ${CMAKE_COMMAND} -E echo_append) + +# Create custom target to generate the VC revision include. +add_custom_command(OUTPUT "${version_inc}" + DEPENDS force_version_inc_check "${llvm_vc}" "${get_svn_script}" + COMMAND + ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}" + "-DLLVM_APPEND_VC_REV=${LLVM_APPEND_VC_REV}" + "-DNAME=LLVM_REVISION" + "-DHEADER_FILE=${version_inc}" + -P "${get_svn_script}") + +# Mark the generated header as being generated. +set_source_files_properties("${version_inc}" + PROPERTIES GENERATED TRUE + HEADER_FILE_ONLY TRUE) add_custom_target(llvm_vcsrevision_h DEPENDS "${version_inc}")