This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Fix dependency issue in TableGen
ClosedPublic

Authored by pzheng on Apr 11 2019, 1:27 PM.

Details

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.

Diff Detail

Event Timeline

pzheng created this revision.Apr 11 2019, 1:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2019, 1:27 PM
aganea accepted this revision.Apr 11 2019, 1:45 PM

Makes sense, thank you for fixing this!

This revision is now accepted and ready to land.Apr 11 2019, 1:45 PM

Thanks for reviewing, aganea!

smeenai accepted this revision.Apr 11 2019, 2:03 PM

LGTM, thanks.

This revision was automatically updated to reflect the committed changes.