[llvm] r358226 - [cmake] Fix dependency issue in TableGen
Pengxuan Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 14:05:15 PDT 2019
Author: pzheng
Date: Thu Apr 11 14:05:15 2019
New Revision: 358226
URL: http://llvm.org/viewvc/llvm-project?rev=358226&view=rev
Log:
[cmake] Fix dependency issue in TableGen
Summary:
There is a bug in add_tablegen which causes cmake to fail with the following
error message if LLVM_TABLEGEN is set.
CMake Error at cmake/modules/TableGen.cmake:147 (add_dependencies):
The dependency target "LLVM-tablegen-host" of target "CLANG-tablegen-host"
does not exist.
Call Stack (most recent call first):
tools/clang/utils/TableGen/CMakeLists.txt:3 (add_tablegen)
The issue happens because setting LLVM_TABLEGEN causes cmake to skip generating
the LLVM-tablegen-host target. As a result, a non-existent target was added for
CLANG-tablegen-host causing cmake to fail.
In order to fix this issue, this patch adds a guard to check the validity of the
dependency target before adding it as a dependency.
Reviewers: aganea, smeenai
Reviewed By: aganea
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60576
Modified:
llvm/trunk/cmake/modules/TableGen.cmake
Modified: llvm/trunk/cmake/modules/TableGen.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=358226&r1=358225&r2=358226&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/TableGen.cmake (original)
+++ llvm/trunk/cmake/modules/TableGen.cmake Thu Apr 11 14:05:15 2019
@@ -143,7 +143,8 @@ macro(add_tablegen target project)
# Create an artificial dependency between tablegen projects, because they
# compile the same dependencies, thus using the same build folders.
# FIXME: A proper fix requires sequentially chaining tablegens.
- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host)
+ if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND
+ TARGET LLVM-tablegen-host)
add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
endif()
endif()
More information about the llvm-commits
mailing list