[llvm] [flang-rt] Make `FLANG_RT_INSTALL_RESOURCE_PATH` configurable (PR #128561)
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 11:47:14 PST 2025
https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/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.
>From e01c58d3d4add1033a124d9a36d644a32dfa96bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Mon, 24 Feb 2025 20:44:17 +0100
Subject: [PATCH] [flang-rt] Make `FLANG_RT_INSTALL_RESOURCE_PATH` configurable
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.
---
flang-rt/CMakeLists.txt | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/flang-rt/CMakeLists.txt b/flang-rt/CMakeLists.txt
index 76e612aebe8ff..9f890a015621a 100644
--- a/flang-rt/CMakeLists.txt
+++ b/flang-rt/CMakeLists.txt
@@ -96,7 +96,7 @@ if (LLVM_TREE_AVAILABLE)
# being added to the build. Flang uses the same resource dir as clang.
include(GetClangResourceDir)
get_clang_resource_dir(FLANG_RT_OUTPUT_RESOURCE_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR}/..")
- get_clang_resource_dir(FLANG_RT_INSTALL_RESOURCE_PATH)
+ get_clang_resource_dir(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT)
extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "${toolchain_lib_subdir}")
else ()
@@ -108,10 +108,12 @@ else ()
# be installed there using the same prefix. This is to not have a difference
# between bootstrap and standalone runtimes builds.
set(FLANG_RT_OUTPUT_RESOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
- set(FLANG_RT_INSTALL_RESOURCE_PATH "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
+ set(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "lib${LLVM_LIBDIR_SUFFIX}")
endif ()
+set(FLANG_RT_INSTALL_RESOURCE_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT}"
+ CACHE PATH "Path to install runtime libraries to (default: clang resource dir)")
extend_path(FLANG_RT_INSTALL_RESOURCE_LIB_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}")
cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_DIR)
cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_PATH)
More information about the llvm-commits
mailing list