-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[CMake] Get Clang directory from CLANG_INSTALL_PREFIX #18460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I disagree with merging any build system related work at this point. |
Sure, this can also be done after the branching of 6.36! |
Test Results 17 files 17 suites 4d 0h 12m 13s ⏱️ Results for commit 5807d94. ♻️ This comment has been updated with latest results. |
@hahnjo, what do you think about this for |
core/clingutils/CMakeLists.txt
Outdated
# If Clang was installed standalone (in particular, not in the LLVM tree), | ||
# use the CLANG_INSTALL_PREFIX variable to indicate where it is. | ||
if(DEFINED CLANG_INSTALL_PREFIX) | ||
set(CLANG_RESOURCE_DIR_STEM ${CLANG_INSTALL_PREFIX}/lib/clang) | ||
else() | ||
set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can always use CLANG_INSTALL_PREFIX
, it's defined by ClangConfig.cmake
. We should also take into account LLVM_LIBDIR_SUFFIX
(untested):
# If Clang was installed standalone (in particular, not in the LLVM tree), | |
# use the CLANG_INSTALL_PREFIX variable to indicate where it is. | |
if(DEFINED CLANG_INSTALL_PREFIX) | |
set(CLANG_RESOURCE_DIR_STEM ${CLANG_INSTALL_PREFIX}/lib/clang) | |
else() | |
set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang) | |
endif() | |
set(CLANG_RESOURCE_DIR_STEM ${CLANG_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}/clang) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! I'll test it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For LLVM_LIBDIR_SUFFIX
, we'll also need #18567
If Clang was installed standalone (in particular, not in the LLVM tree), use the CLANG_INSTALL_PREFIX variable to indicate where it is. Actually, we can always use `CLANG_INSTALL_PREFIX`. It's defined by `ClangConfig.cmake`. We should also need to take into account `LLVM_LIBDIR_SUFFIX`.
79840fe
to
5807d94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm wait, CLANG_INSTALL_PREFIX
is not set for me with builtin_clang=OFF
... Could be that we have to forward it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need
diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt
index e6512a88828..014be83dc28 100644
--- a/interpreter/CMakeLists.txt
+++ b/interpreter/CMakeLists.txt
@@ -407,6 +407,9 @@ if (builtin_clang)
else()
find_package(Clang REQUIRED CONFIG)
message(STATUS "Found Clang ${CLANG_PACKAGE_VERSION} in ${CLANG_CMAKE_DIR}")
+
+ # Forward CLANG_INSTALL_PREFIX so it can be used by core/clingutils/CMakeLists.txt
+ set(CLANG_INSTALL_PREFIX ${CLANG_INSTALL_PREFIX} PARENT_SCOPE)
endif()
# Reset the compiler flags after compiling LLVM and Clang
It might have worked by accident before if /lib/clang/
happened to contain files for the right Clang version...
But the change is in the I have tested it for my setup: system LLVM without Clang and then standalone Clang in different directory, and it works |
Yes sorry, my comment was supposed to say
Can you print the result of |
Ok, I'll check. But I will also make some test with a full LLVM build including patched Clang so I'm more sure to understand all cases. So for me the PR is on hold anyway |
If Clang was installed standalone (in particular, not in the LLVM tree),
use the CLANG_INSTALL_PREFIX variable to indicate where it is.
Actually, we can always use
CLANG_INSTALL_PREFIX
. It's defined byClangConfig.cmake
. We should also need to take into accountLLVM_LIBDIR_SUFFIX
.Follows up on:
builtin_clang=OFF
#18386