[flang-commits] [flang] a6a4d4a - Reland "[flang][build] Fixed paths discrovery for the out-of-tree build. (#87822)"
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Fri Apr 19 11:00:31 PDT 2024
Author: Slava Zakharin
Date: 2024-04-19T11:00:12-07:00
New Revision: a6a4d4a0949fa7aab93429754704f28505d56d3f
URL: https://github.com/llvm/llvm-project/commit/a6a4d4a0949fa7aab93429754704f28505d56d3f
DIFF: https://github.com/llvm/llvm-project/commit/a6a4d4a0949fa7aab93429754704f28505d56d3f.diff
LOG: Reland "[flang][build] Fixed paths discrovery for the out-of-tree build. (#87822)"
This reverts commit 215eee60497489ae0cc7cc78c0d8b8270e057a70.
Added:
Modified:
flang/CMakeLists.txt
Removed:
################################################################################
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 71141e5efac488..c8e75024823f2c 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -81,12 +81,13 @@ if (FLANG_STANDALONE_BUILD)
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
endif()
- # We need a pre-built/installed version of LLVM.
- find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
# If the user specifies a relative path to LLVM_DIR, the calls to include
# LLVM modules fail. Append the absolute path to LLVM_DIR instead.
- get_filename_component(LLVM_DIR_ABSOLUTE ${LLVM_DIR} REALPATH)
+ get_filename_component(LLVM_DIR_ABSOLUTE ${LLVM_DIR}
+ REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR_ABSOLUTE})
+ # We need a pre-built/installed version of LLVM.
+ find_package(LLVM REQUIRED HINTS "${LLVM_DIR_ABSOLUTE}")
# Users might specify a path to CLANG_DIR that's:
# * a full path, or
@@ -97,7 +98,7 @@ if (FLANG_STANDALONE_BUILD)
CLANG_DIR_ABSOLUTE
${CLANG_DIR}
REALPATH
- ${CMAKE_CURRENT_SOURCE_DIR})
+ BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH ${CLANG_DIR_ABSOLUTE})
# TODO: Remove when libclangDriver is lifted out of Clang
@@ -124,13 +125,14 @@ if (FLANG_STANDALONE_BUILD)
include(AddClang)
include(TableGen)
- find_package(MLIR REQUIRED CONFIG)
- # Use SYSTEM for the same reasons as for LLVM includes
- include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
# If the user specifies a relative path to MLIR_DIR, the calls to include
# MLIR modules fail. Append the absolute path to MLIR_DIR instead.
- get_filename_component(MLIR_DIR_ABSOLUTE ${MLIR_DIR} REALPATH)
+ get_filename_component(MLIR_DIR_ABSOLUTE ${MLIR_DIR}
+ REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH ${MLIR_DIR_ABSOLUTE})
+ find_package(MLIR REQUIRED CONFIG HINTS ${MLIR_DIR_ABSOLUTE})
+ # Use SYSTEM for the same reasons as for LLVM includes
+ include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
include(AddMLIR)
find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
More information about the flang-commits
mailing list