Skip to content

Commit 221cf17

Browse files
committed
CMake: Explicitly #undef LLVM_REVISION rather than using a blank file
Including a blank file is confusing and makes it look like something went wrong. Rather than requiring people know why this is blank, let's just make it explicitly #undef the macro that it would define if it weren't empty. llvm-svn: 324659
1 parent 5cf73ce commit 221cf17

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/include/llvm/Support/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSRevision.h")
55

66
set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake")
77

8-
file(WRITE "${version_inc}.empty" "")
8+
file(WRITE "${version_inc}.undef" "#undef LLVM_REVISION\n")
99
if((DEFINED llvm_vc) AND LLVM_APPEND_VC_REV)
1010

1111
execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files
12-
"${version_inc}.empty" "${version_inc}"
12+
"${version_inc}.undef" "${version_inc}"
1313
RESULT_VARIABLE files_not_equal
1414
OUTPUT_QUIET
1515
ERROR_QUIET)
16-
# Remove ${version_inc} if it's empty -- toggling LLVM_APPEND_VC_REV
17-
# from OFF to ON.
16+
# Remove ${version_inc} if it doesn't define a revision. This will force it
17+
# to be regenerated when toggling LLVM_APPEND_VC_REV from OFF to ON.
1818
if(NOT files_not_equal)
1919
file(REMOVE "${version_inc}")
2020
endif()
@@ -28,11 +28,11 @@ if((DEFINED llvm_vc) AND LLVM_APPEND_VC_REV)
2828
"-DHEADER_FILE=${version_inc}"
2929
-P "${get_svn_script}")
3030
else()
31-
# Make sure ${version_inc} is an empty file.
31+
# Make sure ${version_inc} doesn't define a revision
3232
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
33-
"${version_inc}.empty" "${version_inc}")
33+
"${version_inc}.undef" "${version_inc}")
3434
endif()
35-
file(REMOVE "${version_inc}.empty")
35+
file(REMOVE "${version_inc}.undef")
3636

3737
# Mark the generated header as being generated.
3838
set_source_files_properties("${version_inc}"

0 commit comments

Comments
 (0)