[PATCH] D130539: [llvm][cmake] Follow up to D117973
John Ericson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 20:21:32 PDT 2022
Ericson2314 created this revision.
Ericson2314 added reviewers: sebastian-ne, beanz, mstorsjo, phosek, sterni, lebedev.ri.
Herald added a subscriber: mgorny.
Herald added a project: All.
Ericson2314 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
1. Slightly document the "mark advanced" variable used to control the installed CMake package dir.
I would document it more, but I am considering in the future adding pkg-config support in this manner, after which `_PACKGE_DIR` is probably better called `_CMAKE_PACKGE_DIR` or similar.
2. Convey the custom path to the legacy `llvm-config` binary.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D130539
Files:
llvm/docs/CMake.rst
llvm/tools/llvm-config/BuildVariables.inc.in
llvm/tools/llvm-config/llvm-config.cpp
Index: llvm/tools/llvm-config/llvm-config.cpp
===================================================================
--- llvm/tools/llvm-config/llvm-config.cpp
+++ llvm/tools/llvm-config/llvm-config.cpp
@@ -370,7 +370,11 @@
ActiveBinDir = std::string(Path.str());
}
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
+ {
+ SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR);
+ sys::fs::make_absolute(ActivePrefix, Path);
+ ActiveCMakeDir = std::string(Path.str());
+ }
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
Index: llvm/tools/llvm-config/BuildVariables.inc.in
===================================================================
--- llvm/tools/llvm-config/BuildVariables.inc.in
+++ llvm/tools/llvm-config/BuildVariables.inc.in
@@ -24,6 +24,7 @@
#define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
+#define LLVM_INSTALL_PACKAGE_DIR "@LLVM_INSTALL_PACKAGE_DIR@"
#define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
#define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
#define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
Index: llvm/docs/CMake.rst
===================================================================
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -941,9 +941,11 @@
This file is available in two different locations.
-* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
- ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+* ``<LLVM_INSTALL_PACKAGE_DIR>/LLVMConfig.cmake`` where
+ ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
+ installed as part of an installed version of LLVM. This is typically
+ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
+ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
* ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130539.447541.patch
Type: text/x-patch
Size: 2128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220726/de84945d/attachment.bin>
More information about the llvm-commits
mailing list