This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] Fix build when no targets are enabled
ClosedPublic

Authored by steveire on Jan 3 2021, 5:52 AM.

Details

Summary

This makes sense to do when building only tools like clang-tidy for
example.

Diff Detail

Event Timeline

steveire created this revision.Jan 3 2021, 5:52 AM
steveire requested review of this revision.Jan 3 2021, 5:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2021, 5:52 AM
aaron.ballman added inline comments.Jan 4 2021, 10:09 AM
llvm/cmake/modules/LLVM-Config.cmake
31

I'm not a CMake expert, so can you explain what effect this change has? From the documentation (and my own limited understanding of cmake), I would have expected this to be a noop -- if the list of elements is empty, nothing will get removed from omitted_targets, right?

steveire added inline comments.Jan 4 2021, 1:35 PM
llvm/cmake/modules/LLVM-Config.cmake
31

You can reproduce the issue in a small testcase with this file:

set(omitted_targets one two three)

# Comment this to reproduce the failure
set(LLVM_TARGETS_TO_BUILD X86)

list(REMOVE_ITEM omitted_targets ${LLVM_TARGETS_TO_BUILD})

Run this after commenting the line:

$ cmake -P cmaketest.cmake
CMake Error at cmaketest.cmake:6 (list):
  list sub-command REMOVE_ITEM requires two or more arguments.
aaron.ballman accepted this revision.Jan 5 2021, 5:51 AM

LGTM

llvm/cmake/modules/LLVM-Config.cmake
31

Huh, wow, how unintuitive! Thank you for the explanation.

This revision is now accepted and ready to land.Jan 5 2021, 5:51 AM
steveire added inline comments.Jan 5 2021, 6:43 AM
llvm/cmake/modules/LLVM-Config.cmake
31