diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -48,9 +48,13 @@ list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR_ABSOLUTE}) if(FLANG_BUILD_NEW_DRIVER) + # If the user specifies a relative path to CLANG_DIR, the calls to include + # Clang modules fail. Append the absolute path to CLANG_DIR instead. + get_filename_component(CLANG_DIR_ABSOLUTE ${CLANG_DIR} REALPATH) + list(APPEND CMAKE_MODULE_PATH ${CLANG_DIR_ABSOLUTEDIR}) + # 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 HINTS "${CLANG_DIR_ABSOLUTE}") endif() # If LLVM links to zlib we need the imported targets so we can too.