This is an archive of the discontinued LLVM Phabricator instance.

[CMake][llvm] avoid includes with generator-expressions in add_custom_command
Needs ReviewPublic

Authored by radford on Apr 20 2021, 3:39 PM.

Details

Reviewers
arphaman
Summary

Table generation's add_custom_command will break when any of the
INCLUDE_DIRECTORIES uses generator-expressions.

Diff Detail

Event Timeline

radford created this revision.Apr 20 2021, 3:39 PM
radford requested review of this revision.Apr 20 2021, 3:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2021, 3:39 PM

What's a scenario where you'd end up with a generator expression in tblgen_includes? I'm concerned that stripping generator expressions just hides the problem.

When adding LLVM as a cmake sub-project in a larger project, the larger project might have (and did have in my case) unrelated-to-LLVM generator-expression-wrapped includes.

To be clear, add_custom_command *does* support generator-expressions, just not things like COMPILE_LANGUAGE which give an error like:

$<COMPILE_LANGUAGE:...> may only be used to specify include directories,
compile definitions, compile options, and to evaluate components of the
file(GENERATE) command.

So in my case this isn’t hiding a bigger problem, but it could conceivably in some cases.