Skip to content

Commit d254fa8

Browse files
authored
[flang-rt] Make FLANG_RT_INSTALL_RESOURCE_PATH configurable (#128561)
Make it possible to change the path used to install flang-rt library. This is particularly necessary for standalone builds, where the CMake script currently hardwires the default clang install path, and therefore is incorrect for distributions that override it. However, for consistency I have made it configurable unconditionally, preserving the current defaults.
1 parent 5088e1b commit d254fa8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flang-rt/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if (LLVM_TREE_AVAILABLE)
9696
# being added to the build. Flang uses the same resource dir as clang.
9797
include(GetClangResourceDir)
9898
get_clang_resource_dir(FLANG_RT_OUTPUT_RESOURCE_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR}/..")
99-
get_clang_resource_dir(FLANG_RT_INSTALL_RESOURCE_PATH)
99+
get_clang_resource_dir(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT)
100100

101101
extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "${toolchain_lib_subdir}")
102102
else ()
@@ -108,10 +108,12 @@ else ()
108108
# be installed there using the same prefix. This is to not have a difference
109109
# between bootstrap and standalone runtimes builds.
110110
set(FLANG_RT_OUTPUT_RESOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
111-
set(FLANG_RT_INSTALL_RESOURCE_PATH "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
111+
set(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
112112

113113
extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "lib${LLVM_LIBDIR_SUFFIX}")
114114
endif ()
115+
set(FLANG_RT_INSTALL_RESOURCE_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT}"
116+
CACHE PATH "Path to install runtime libraries to (default: clang resource dir)")
115117
extend_path(FLANG_RT_INSTALL_RESOURCE_LIB_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}")
116118
cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_DIR)
117119
cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_PATH)

0 commit comments

Comments
 (0)