This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Add clang's targets to LLVM's export set when not building standalone
AbandonedPublic

Authored by beanz on Jan 13 2016, 2:57 PM.

Details

Summary

CMake freaks out in trivial cases like:

cmake -G Ninja -DLLVM_ENABLE_PIC=Off -DLLVM_INSTALL_TOOLCHAIN_ONLY=On ../llvm

This is a result of static ink dependencies not all being part of the same export group, and was caused by r249935.

Diff Detail

Event Timeline

beanz updated this revision to Diff 44798.Jan 13 2016, 2:57 PM
beanz retitled this revision from to [CMake] Add clang's targets to LLVM's export set when not building standalone.
beanz updated this object.
beanz added reviewers: rnk, chapuni, hintonda.
beanz added a subscriber: cfe-commits.
hintonda edited edge metadata.Jan 16 2016, 3:18 PM

Sorry the previous change caused this configuration to break. However, I'm not sure about adding LLVMExports here. Shouldn't that be handled in llvm/CMakeLists.txt?

In fact, this looks like a cmake bug (or feature) that won't let you export a target that depends on a static lib without also exporting that static lib. Since you've set LLVM_INSTALL_TOOLCHAIN_ONLY, you don't want to export those statics libs anyway, since they won't be available.

I'll play around with it and see if I can come up with something that works for all configurations.

beanz abandoned this revision.Jan 19 2016, 9:33 AM

@hintonda, your comment actually trigged something in my brain and I just realized the problem. It is a much simpler fix. If you set LLVM_ENABLE_PIC=Off libclang isn't built as a dylib, it is a static lib. If LLVM_INSTALL_TOOLCHAIN_ONLY=On, we need to exclude all static libraries from the Clang exports file.

Ah, great. That is simpler.