r309390 - [CMake] NFC. Add clang-tablegen-targets utility target
Chris Bieneman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 28 08:33:47 PDT 2017
Author: cbieneman
Date: Fri Jul 28 08:33:47 2017
New Revision: 309390
URL: http://llvm.org/viewvc/llvm-project?rev=309390&view=rev
Log:
[CMake] NFC. Add clang-tablegen-targets utility target
By creating this target other projects that depend on clang-generated headers (like LLDB) will no longer be order-dependent on Clang being processed by CMake first.
Also, by creating a dummy of this target in ClangConfig.cmake, projects that can build against out-of-tree clang can freely depend on the target without needing to have conditionals for if clang is in-tree or out-of-tree.
Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/cmake/modules/ClangConfig.cmake.in
Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=309390&r1=309389&r2=309390&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Jul 28 08:33:47 2017
@@ -412,7 +412,8 @@ add_subdirectory(include)
# All targets below may depend on all tablegen'd files.
get_property(CLANG_TABLEGEN_TARGETS GLOBAL PROPERTY CLANG_TABLEGEN_TARGETS)
-list(APPEND LLVM_COMMON_DEPENDS ${CLANG_TABLEGEN_TARGETS})
+add_custom_target(clang-tablegen-targets DEPENDS ${CLANG_TABLEGEN_TARGETS})
+list(APPEND LLVM_COMMON_DEPENDS clang-tablegen-targets)
# Force target to be built as soon as possible. Clang modules builds depend
# header-wise on it as they ship all headers from the umbrella folders. Building
Modified: cfe/trunk/cmake/modules/ClangConfig.cmake.in
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/ClangConfig.cmake.in?rev=309390&r1=309389&r2=309390&view=diff
==============================================================================
--- cfe/trunk/cmake/modules/ClangConfig.cmake.in (original)
+++ cfe/trunk/cmake/modules/ClangConfig.cmake.in Fri Jul 28 08:33:47 2017
@@ -11,3 +11,10 @@ set(CLANG_INCLUDE_DIRS "@CLANG_CONFIG_IN
# Provide all our library targets to users.
include("@CLANG_CONFIG_EXPORTS_FILE@")
+
+# By creating clang-tablegen-targets here, subprojects that depend on Clang's
+# tablegen-generated headers can always depend on this target whether building
+# in-tree with Clang or not.
+if(NOT TARGET clang-tablegen-targets)
+ add_custom_target(clang-tablegen-targets)
+endif()
More information about the cfe-commits
mailing list