This is an archive of the discontinued LLVM Phabricator instance.

CMake: Set LLVM_MAIN_INCLUDE_DIR to LLVM_INCLUDE_DIR
AcceptedPublic

Authored by tstellar on Apr 26 2017, 7:39 PM.

Details

Reviewers
beanz
mgorny
Summary

LLVM_INCLUDE_DIR comes from LLVMConfig.cmake, which is already available to
us, so we don't need to user llvm-config to query this value.

Also, the value returned by llvm-config is wrong if llvm-config is
installed to a different prefix than the includes.

Event Timeline

tstellar created this revision.Apr 26 2017, 7:39 PM

The changes themselves look good.
But I don't understand your issue. Did you happen to any cases that llvm-config or --includedir prevents something?

I think we may get rid of llvm-config there in near future. Instead, we should let CMake find LLVM as a package.

Possible steps;

  1. Use llvm-config just to inform --cmakedir.
  2. Add an option to use find_package(LLVM).
  3. Nuke llvm-config stuff. (Then, we might miss consistency of llvm-config...)

The changes themselves look good.
But I don't understand your issue. Did you happen to any cases that llvm-config or --includedir prevents something?

If you install llvm-config to /usr/libexec/llvm/bin, then llvm-config --includedir will ignore where the include files actually are and always return /usr/libexec/llvm/include

I think we may get rid of llvm-config there in near future. Instead, we should let CMake find LLVM as a package.

Possible steps;

  1. Use llvm-config just to inform --cmakedir.
  2. Add an option to use find_package(LLVM).
  3. Nuke llvm-config stuff. (Then, we might miss consistency of llvm-config...)

This is what I'm looking at doing. This is just one of the preliminary cleanups.

If you install llvm-config to /usr/libexec/llvm/bin, then llvm-config --includedir will ignore where the include files actually are and always return /usr/libexec/llvm/include

It's a problem in llvm-config, I think. llvm-config should know installed prefix(es).

mgorny accepted this revision.Nov 10 2018, 2:25 AM

LGTM.

This revision is now accepted and ready to land.Nov 10 2018, 2:25 AM