[PATCH] D99088: [flang][cmake] Make sure that CLANG_DIR is an absolute path
Andrzej Warzynski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 23 07:18:36 PDT 2021
awarzynski updated this revision to Diff 332668.
awarzynski added a comment.
Make the semantics of CLANG_DIR more explicit
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99088/new/
https://reviews.llvm.org/D99088
Files:
flang/CMakeLists.txt
Index: flang/CMakeLists.txt
===================================================================
--- flang/CMakeLists.txt
+++ flang/CMakeLists.txt
@@ -48,9 +48,23 @@
list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR_ABSOLUTE})
if(FLANG_BUILD_NEW_DRIVER)
+ # Users might specify a path to CLANG_DIR that's:
+ # * a full path, or
+ # * a path relative to the path of this script.
+ # Append the absolute path to CLANG_DIR so that find_package works in both
+ # cases.
+ get_filename_component(
+ CLANG_DIR_ABSOLUTE
+ ${CLANG_DIR}
+ REALPATH
+ CMAKE_CURRENT_SOURCE_DIR)
+ list(APPEND CMAKE_MODULE_PATH ${CLANG_DIR_ABSOLUTE})
+
# TODO: Remove when libclangDriver is lifted out of Clang
- list(APPEND CMAKE_MODULE_PATH ${CLANG_DIR})
- find_package(Clang REQUIRED HINTS "${CLANG_DIR}")
+ find_package(Clang REQUIRED PATHS "${CLANG_DIR_ABSOLUTE}" NO_DEFAULT_PATH)
+ if (NOT Clang_FOUND)
+ message(FATAL_ERROR "Failed to find Clang")
+ endif()
endif()
# If LLVM links to zlib we need the imported targets so we can too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99088.332668.patch
Type: text/x-patch
Size: 1088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210323/f5aedf6a/attachment.bin>
More information about the llvm-commits
mailing list