summaryrefslogtreecommitdiff
path: root/tools/llvm-config/llvm-config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-config/llvm-config.cpp')
-rw-r--r--tools/llvm-config/llvm-config.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index d780094861c6..58571cc59b79 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -196,6 +196,7 @@ Options:\n\
--bindir Directory containing LLVM executables.\n\
--includedir Directory containing LLVM headers.\n\
--libdir Directory containing LLVM libraries.\n\
+ --cmakedir Directory containing LLVM cmake modules.\n\
--cppflags C preprocessor flags for files that include LLVM headers.\n\
--cflags C compiler flags for files that include LLVM headers.\n\
--cxxflags C++ compiler flags for files that include LLVM headers.\n\
@@ -302,7 +303,8 @@ int main(int argc, char **argv) {
// Compute various directory locations based on the derived location
// information.
- std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir;
+ std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
+ ActiveCMakeDir;
std::string ActiveIncludeOption;
if (IsInDevelopmentTree) {
ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
@@ -314,12 +316,14 @@ int main(int argc, char **argv) {
case CMakeStyle:
ActiveBinDir = ActiveObjRoot + "/bin";
ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
break;
case CMakeBuildModeStyle:
ActivePrefix = ActiveObjRoot;
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
ActiveLibDir =
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
break;
}
@@ -331,6 +335,7 @@ int main(int argc, char **argv) {
ActiveIncludeDir = ActivePrefix + "/include";
ActiveBinDir = ActivePrefix + "/bin";
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
@@ -357,6 +362,7 @@ int main(int argc, char **argv) {
std::replace(ActivePrefix.begin(), ActivePrefix.end(), '/', '\\');
std::replace(ActiveBinDir.begin(), ActiveBinDir.end(), '/', '\\');
std::replace(ActiveLibDir.begin(), ActiveLibDir.end(), '/', '\\');
+ std::replace(ActiveCMakeDir.begin(), ActiveCMakeDir.end(), '/', '\\');
std::replace(ActiveIncludeOption.begin(), ActiveIncludeOption.end(), '/',
'\\');
}
@@ -475,6 +481,8 @@ int main(int argc, char **argv) {
OS << ActiveIncludeDir << '\n';
} else if (Arg == "--libdir") {
OS << ActiveLibDir << '\n';
+ } else if (Arg == "--cmakedir") {
+ OS << ActiveCMakeDir << '\n';
} else if (Arg == "--cppflags") {
OS << ActiveIncludeOption << ' ' << LLVM_CPPFLAGS << '\n';
} else if (Arg == "--cflags") {