Use configure depends to trigger reconfiguration when LLVMBuild files change

Summary:
The existing logic has a workaround where configure_file is used to write a single dummy file output many times.

CMake has a feature to more directly add the dependency and avoid the dummy file (it is available in the minimum version specified).

Reviewers: theraven

Reviewed By: theraven

Subscribers: theraven, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80218
This commit is contained in:
Daniel Frampton 2020-05-21 11:03:24 +01:00 committed by David Chisnall
parent 099a875f28
commit e72cba9757

View File

@ -563,19 +563,10 @@ subdirectories = %s
f.write("""
# LLVMBuild CMake fragment dependencies.
#
# CMake has no builtin way to declare that the configuration depends on
# a particular file. However, a side effect of configure_file is to add
# said input file to CMake's internal dependency list. So, we use that
# and a dummy output file to communicate the dependency information to
# CMake.
#
# FIXME: File a CMake RFE to get a properly supported version of this
# feature.
""")
for dep in dependencies:
f.write("""\
configure_file(\"%s\"
${CMAKE_CURRENT_BINARY_DIR}/DummyConfigureOutput)\n""" % (
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS \"%s\")\n""" % (
cmake_quote_path(dep),))
# Write the properties we use to encode the required library dependency