Page MenuHomePhabricator

[llvm] [cmake] Provide split include paths in LLVMConfig
ClosedPublic

Authored by mgorny on Feb 12 2019, 2:22 AM.

Details

Summary

Modify LLVMConfig to provide split variables for in-source and generated
include paths. Currently, it uses a single value for both
LLVM_INCLUDE_DIRS and LLVM_INCLUDE_DIR which works for install tree but
fails hard at build tree (where LLVM_INCLUDE_DIR incorrectly contains
multiple values).

Instead, put the generated directory in LLVM_INCLUDE_DIR, and the source
tree in LLVM_MAIN_INCLUDE_DIR which is consistent with in-LLVM builds.
For install tree, both variables will have the same value.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Feb 12 2019, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2019, 2:22 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
sgraenitz added a comment.EditedFeb 12 2019, 3:51 AM

Can't speak for all the subprojects, but with D57995 this should work for LLDB.

Getting some more people for their opinion on this.

rnk added a comment.Feb 12 2019, 10:26 AM

It seems like we could move clients of the single variable, LLVM_INCLUDE_DIR, to the LLVM_INCLUDE_DIRS list instead of doing this. Are there any reasons why that doesn't work for some clients?
This new arrangement bakes in the idea that LLVM has at most two include dirs, which is OK, I doubt we'll break that assumption.

Yeah, I was thinking of doing that too (in particular making TableGen.cmake use it instead of LLVM_MAIN_INCLUDE_DIR) but I'm not sure if someone doesn't have some obscure use case I'd break this way. My main concern is that other packages had LLVM_MAIN_INCLUDE_DIR as cache variable for stand-alone builds, so people could've overrode it independently of LLVM_INCLUDE_DIRS.

Subscribing @compnerd so that he can properly rebase D58109 after this change (or a change like it) goes in.

rnk accepted this revision.Feb 12 2019, 3:44 PM

lgtm

This revision is now accepted and ready to land.Feb 12 2019, 3:44 PM
This revision was automatically updated to reflect the committed changes.