Skip to content

Commit

Permalink
[flang-rt] Make FLANG_RT_INSTALL_RESOURCE_PATH configurable (#128561)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mgorny authored Feb 25, 2025
1 parent 5088e1b commit d254fa8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flang-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand All @@ -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)
Expand Down

0 comments on commit d254fa8

Please sign in to comment.