Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.
/ swift-llvm Public archive

Commit 04ee2c9

Browse files
committed
Fix llvm-config support for CMake build-mode-style builds
At some point we and/or CMake changed our build-mode-style builds from $LLVM_OBJ_ROOT/bin/$CMAKE_CFG_INTDIR/ to $LLVM_OBJ_ROOT/$CMAKE_CFG_INTDIR/bin/ which is way easier to use. But no one updated llvm-config. https://reviews.llvm.org/D66326 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369129 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent c4f6a89 commit 04ee2c9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/llvm-config/llvm-config.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ int main(int argc, char **argv) {
291291
IsInDevelopmentTree = true;
292292
DevelopmentTreeLayout = CMakeStyle;
293293
ActiveObjRoot = LLVM_OBJ_ROOT;
294-
} else if (sys::fs::equivalent(CurrentExecPrefix,
295-
Twine(LLVM_OBJ_ROOT) + "/bin")) {
294+
} else if (sys::fs::equivalent(sys::path::parent_path(CurrentExecPrefix),
295+
LLVM_OBJ_ROOT)) {
296296
IsInDevelopmentTree = true;
297297
DevelopmentTreeLayout = CMakeBuildModeStyle;
298298
ActiveObjRoot = LLVM_OBJ_ROOT;
@@ -319,11 +319,14 @@ int main(int argc, char **argv) {
319319
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
320320
break;
321321
case CMakeBuildModeStyle:
322+
// FIXME: Should we consider the build-mode-specific path as the prefix?
322323
ActivePrefix = ActiveObjRoot;
323-
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
324+
ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin";
324325
ActiveLibDir =
325-
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
326-
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
326+
ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX;
327+
// The CMake directory isn't separated by build mode.
328+
ActiveCMakeDir =
329+
ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX + "/cmake/llvm";
327330
break;
328331
}
329332

0 commit comments

Comments
 (0)