[Openmp-commits] [openmp] f7a3309 - [cmake] Use `CMAKE_INSTALL_LIBDIR` too
John Ericson via Openmp-commits
openmp-commits at lists.llvm.org
Thu Aug 18 12:33:43 PDT 2022
Author: John Ericson
Date: 2022-08-18T15:33:35-04:00
New Revision: f7a33090a91015836497c75f173775392ab0304d
URL: https://github.com/llvm/llvm-project/commit/f7a33090a91015836497c75f173775392ab0304d
DIFF: https://github.com/llvm/llvm-project/commit/f7a33090a91015836497c75f173775392ab0304d.diff
LOG: [cmake] Use `CMAKE_INSTALL_LIBDIR` too
We held off on this before as `LLVM_LIBDIR_SUFFIX` conflicted with it.
Now we return this.
`LLVM_LIBDIR_SUFFIX` is kept as a deprecated way to set
`CMAKE_INSTALL_LIBDIR`. The other `*_LIBDIR_SUFFIX` are just removed
entirely.
I imagine this is too potentially-breaking to make LLVM 15. That's fine.
I have a more minimal version of this in the disto (NixOS) patches for
LLVM 15 (like previous versions). This more expansive version I will
test harder after the release is cut.
Reviewed By: sebastian-ne, ldionne, #libc, #libc_abi
Differential Revision: https://reviews.llvm.org/D130586
Added:
Modified:
bolt/runtime/CMakeLists.txt
clang/CMakeLists.txt
clang/cmake/caches/Android-stage2.cmake
clang/cmake/caches/Android.cmake
clang/cmake/modules/AddClang.cmake
clang/cmake/modules/CMakeLists.txt
clang/include/clang/Config/config.h.cmake
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/Cuda.cpp
clang/lib/Headers/CMakeLists.txt
clang/runtime/CMakeLists.txt
clang/tools/libclang/CMakeLists.txt
clang/tools/scan-build-py/CMakeLists.txt
cmake/Modules/GNUInstallPackageDir.cmake
compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
compiler-rt/cmake/Modules/CompilerRTUtils.cmake
compiler-rt/cmake/base-config-ix.cmake
compiler-rt/docs/BuildingCompilerRT.rst
flang/CMakeLists.txt
flang/cmake/modules/AddFlang.cmake
flang/cmake/modules/CMakeLists.txt
libc/CMakeLists.txt
libc/lib/CMakeLists.txt
libcxx/CMakeLists.txt
libcxx/docs/BuildingLibcxx.rst
libcxxabi/CMakeLists.txt
libunwind/CMakeLists.txt
libunwind/docs/BuildingLibunwind.rst
lld/CMakeLists.txt
lld/cmake/modules/AddLLD.cmake
lld/cmake/modules/CMakeLists.txt
lldb/cmake/modules/AddLLDB.cmake
lldb/cmake/modules/LLDBConfig.cmake
lldb/cmake/modules/LLDBGenerateConfig.cmake
lldb/cmake/modules/LLDBStandalone.cmake
lldb/include/lldb/Host/Config.h.cmake
lldb/source/API/CMakeLists.txt
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
lldb/tools/intel-features/CMakeLists.txt
lldb/unittests/Expression/ClangParserTest.cpp
llvm/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/AddOCaml.cmake
llvm/cmake/modules/CMakeLists.txt
llvm/cmake/modules/LLVMConfig.cmake.in
llvm/docs/CMake.rst
llvm/tools/llvm-config/BuildVariables.inc.in
llvm/tools/llvm-config/llvm-config.cpp
llvm/tools/llvm-shlib/CMakeLists.txt
llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
mlir/CMakeLists.txt
mlir/cmake/modules/AddMLIR.cmake
mlir/cmake/modules/AddMLIRPython.cmake
mlir/cmake/modules/CMakeLists.txt
mlir/test/CMakeLists.txt
openmp/CMakeLists.txt
openmp/README.rst
polly/cmake/CMakeLists.txt
polly/cmake/polly_macros.cmake
polly/test/CMakeLists.txt
pstl/CMakeLists.txt
third-party/benchmark/src/CMakeLists.txt
utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
Removed:
################################################################################
diff --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt
index ef7ad02c98c77..72aae2edb7970 100644
--- a/bolt/runtime/CMakeLists.txt
+++ b/bolt/runtime/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.13.4)
include(CheckIncludeFiles)
+include(GNUInstallDirs)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
@@ -32,8 +33,8 @@ target_include_directories(bolt_rt_instr PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(bolt_rt_hugify PRIVATE ${BOLT_RT_FLAGS})
target_include_directories(bolt_rt_hugify PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-install(TARGETS bolt_rt_instr DESTINATION lib)
-install(TARGETS bolt_rt_hugify DESTINATION lib)
+install(TARGETS bolt_rt_instr DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+install(TARGETS bolt_rt_hugify DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
add_library(bolt_rt_instr_osx STATIC
@@ -44,5 +45,5 @@ if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
target_compile_options(bolt_rt_instr_osx PRIVATE
-target x86_64-apple-darwin19.6.0
${BOLT_RT_FLAGS})
- install(TARGETS bolt_rt_instr_osx DESTINATION lib)
+ install(TARGETS bolt_rt_instr_osx DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 60f6c162a2d55..9eff5e452c55d 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -37,7 +37,7 @@ if(CLANG_BUILT_STANDALONE)
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
@@ -72,8 +72,8 @@ if(CLANG_BUILT_STANDALONE)
link_directories("${LLVM_LIBRARY_DIR}")
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
- set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
- set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
+ set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
+ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
if(LLVM_INCLUDE_TESTS)
find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
@@ -303,9 +303,6 @@ if (NOT LLVM_LINK_LLVM_DYLIB AND CLANG_LINK_CLANG_DYLIB)
"LLVM_LINK_LLVM_DYLIB=OFF")
endif()
-# The libdir suffix must exactly match whatever LLVM's configuration used.
-set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}")
-
set(CLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
"Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
mark_as_advanced(CLANG_TOOLS_INSTALL_DIR)
@@ -871,6 +868,8 @@ if(CLANG_BUILT_STANDALONE)
process_llvm_pass_plugins()
endif()
+get_filename_component(CLANG_INSTALL_LIBDIR_BASENAME "${CMAKE_INSTALL_LIBDIR}" NAME)
+
configure_file(
${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake
${CLANG_BINARY_DIR}/include/clang/Config/config.h)
diff --git a/clang/cmake/caches/Android-stage2.cmake b/clang/cmake/caches/Android-stage2.cmake
index 6720517590ab9..9c102840a6f78 100644
--- a/clang/cmake/caches/Android-stage2.cmake
+++ b/clang/cmake/caches/Android-stage2.cmake
@@ -4,7 +4,7 @@ set(CLANG_VENDOR Android CACHE STRING "")
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
-set(LLVM_LIBDIR_SUFFIX 64 CACHE STRING "")
+set(CMAKE_INSTALL_LIBDIR "lib64" CACHE STRING "")
set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
set(ANDROID_RUNTIMES_ENABLE_ASSERTIONS ON CACHE BOOL "")
diff --git a/clang/cmake/caches/Android.cmake b/clang/cmake/caches/Android.cmake
index 9e15fff033761..b7634dcc1ce34 100644
--- a/clang/cmake/caches/Android.cmake
+++ b/clang/cmake/caches/Android.cmake
@@ -13,7 +13,7 @@ set(HAVE_LIBCXXABI ON CACHE BOOL "")
set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
-set(LLVM_LIBDIR_SUFFIX 64 CACHE STRING "")
+set(CMAKE_INSTALL_LIBDIR "lib64" CACHE STRING "")
set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index 21ac332e4f5fc..4ef2f8aee919c 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -119,8 +119,8 @@ macro(add_clang_library name)
install(TARGETS ${lib}
COMPONENT ${lib}
${export_to_clangtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if (NOT LLVM_ENABLE_IDE)
diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt
index 6a7fa2fa27ebb..c6df1c82f2265 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -9,13 +9,13 @@ include(FindPrefixFromConfig)
set(CLANG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/clang" CACHE STRING
"Path for CMake subdirectory for Clang (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/clang')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
+set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib/cmake/clang")
# Keep this in sync with llvm/cmake/CMakeLists.txt!
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)
diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake
index dfd2f757a185b..a4083827e43f8 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -53,8 +53,8 @@
/* Default architecture for SystemZ. */
#define CLANG_SYSTEMZ_DEFAULT_ARCH "${CLANG_SYSTEMZ_DEFAULT_ARCH}"
-/* Multilib suffix for libdir. */
-#define CLANG_LIBDIR_SUFFIX "${CLANG_LIBDIR_SUFFIX}"
+/* Multilib basename for libdir. */
+#define CLANG_INSTALL_LIBDIR_BASENAME "${CLANG_INSTALL_LIBDIR_BASENAME}"
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}"
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 59ddc89269d95..31cd5865c8168 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -180,7 +180,7 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
// path of the embedding binary, which for LLVM binaries will be in bin/.
// ../lib gets us to lib/ in both cases.
P = llvm::sys::path::parent_path(Dir);
- llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
+ llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
CLANG_VERSION_STRING);
}
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 77ce0395cf3c1..c0aec33b082a5 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -502,7 +502,8 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
SmallString<1024> Plugin;
llvm::sys::path::native(
- Twine(D.Dir) + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" + Suffix,
+ Twine(D.Dir) + "/../" CLANG_INSTALL_LIBDIR_BASENAME "/LLVMgold" +
+ Suffix,
Plugin);
CmdArgs.push_back(Args.MakeArgString(Plugin));
}
@@ -658,7 +659,7 @@ void tools::addOpenMPRuntimeSpecificRPath(const ToolChain &TC,
// runtime
SmallString<256> DefaultLibPath =
llvm::sys::path::parent_path(TC.getDriver().Dir);
- llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
+ llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME);
CmdArgs.push_back("-rpath");
CmdArgs.push_back(Args.MakeArgString(DefaultLibPath));
}
@@ -671,7 +672,7 @@ void tools::addOpenMPRuntimeLibraryPath(const ToolChain &TC,
// runtime.
SmallString<256> DefaultLibPath =
llvm::sys::path::parent_path(TC.getDriver().Dir);
- llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
+ llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME);
CmdArgs.push_back(Args.MakeArgString("-L" + DefaultLibPath));
}
@@ -1947,7 +1948,7 @@ void tools::AddStaticDeviceLibs(Compilation *C, const Tool *T,
// Add path to lib-debug folders
SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
- llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
+ llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME);
LibraryPaths.emplace_back(DefaultLibPath.c_str());
// Build list of Static Device Libraries SDLs specified by -l option
@@ -2076,7 +2077,7 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
// Add path to clang lib / lib64 folder.
SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
- llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
+ llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME);
LibraryPaths.emplace_back(DefaultLibPath.c_str());
// Add user defined library paths from LIBRARY_PATH.
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
index 7ad990dda467e..40f19e4ecc6d8 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -592,7 +592,7 @@ void NVPTX::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA,
// Add paths for the default clang library path.
SmallString<256> DefaultLibPath =
llvm::sys::path::parent_path(TC.getDriver().Dir);
- llvm::sys::path::append(DefaultLibPath, "lib" CLANG_LIBDIR_SUFFIX);
+ llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME);
CmdArgs.push_back(Args.MakeArgString(Twine("-L") + DefaultLibPath));
for (const auto &II : Inputs) {
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index 6e2060991b921..649b1ef3f70a2 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -420,7 +420,7 @@ add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
add_header_target("windows-resource-headers" ${windows_only_files})
add_header_target("utility-resource-headers" ${utility_files})
-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include)
#############################################################
# Install rules for the catch-all clang-resource-headers target
diff --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt
index 9f4633bc85b12..7991a017492f6 100644
--- a/clang/runtime/CMakeLists.txt
+++ b/clang/runtime/CMakeLists.txt
@@ -84,10 +84,12 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
-DLLVM_LIT_ARGS=${LLVM_LIT_ARGS}
-DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
-DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
- -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
+ -DCOMPILER_RT_INSTALL_PATH:PATH=lib/clang/${CLANG_VERSION}
-DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
- -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
- -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
+ -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
+ -DCMAKE_INSTALL_BINDIR="${CMAKE_INSTALL_BINDIR}"
+ -DCMAKE_INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}"
+ -DCMAKE_INSTALL_INCLUDEDIR="${CMAKE_INSTALL_INCLUDEDIR}"
-DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 8d95d0900e8c4..3926b7e323bab 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -180,7 +180,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
COMPONENT
libclang-python-bindings
DESTINATION
- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ "${CMAKE_INSTALL_LIBDIR}/python${PythonVersion}/site-packages")
endforeach()
if(NOT LLVM_ENABLE_IDE)
add_custom_target(libclang-python-bindings)
diff --git a/clang/tools/scan-build-py/CMakeLists.txt b/clang/tools/scan-build-py/CMakeLists.txt
index 061dc7ef4dd9e..adc54b2edc327 100644
--- a/clang/tools/scan-build-py/CMakeLists.txt
+++ b/clang/tools/scan-build-py/CMakeLists.txt
@@ -88,7 +88,7 @@ foreach(lib ${LibScanbuild})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib})
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib})
install(PROGRAMS lib/libscanbuild/${lib}
- DESTINATION lib/libscanbuild
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild"
COMPONENT scan-build-py)
endforeach()
@@ -106,7 +106,7 @@ foreach(resource ${LibScanbuildResources})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource})
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource})
install(PROGRAMS lib/libscanbuild/resources/${resource}
- DESTINATION lib/libscanbuild/resources
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild/resources"
COMPONENT scan-build-py)
endforeach()
@@ -122,7 +122,7 @@ foreach(lib ${LibEar})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib})
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib})
install(PROGRAMS lib/libear/${lib}
- DESTINATION lib/libear
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libear"
COMPONENT scan-build-py)
endforeach()
diff --git a/cmake/Modules/GNUInstallPackageDir.cmake b/cmake/Modules/GNUInstallPackageDir.cmake
index e4a058e68f4f4..e4e84b6fc0570 100644
--- a/cmake/Modules/GNUInstallPackageDir.cmake
+++ b/cmake/Modules/GNUInstallPackageDir.cmake
@@ -29,5 +29,5 @@ macro(_GNUInstallPackageDir_cache_path var default description)
_GNUInstallPackageDir_cache_convert_to_path("${var}" "${description}")
endmacro()
-_GNUInstallPackageDir_cache_path(CMAKE_INSTALL_PACKAGEDIR "lib${LLVM_LIBDIR_SUFFIX}/cmake"
+_GNUInstallPackageDir_cache_path(CMAKE_INSTALL_PACKAGEDIR "${CMAKE_INSTALL_LIBDIR}/cmake"
"Directories containing installed CMake modules (lib/cmake)")
diff --git a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
index d28b46463e7f5..3159b6f0b178a 100644
--- a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
@@ -62,7 +62,7 @@ macro(archive_aix_libatomic name libname)
# setting _install_rpath on AIX for reference.
if(LLVM_LIBRARY_OUTPUT_INTDIR AND CMAKE_INSTALL_PREFIX)
set(output_dir "${LLVM_LIBRARY_OUTPUT_INTDIR}")
- set(install_dir "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+ set(install_dir "${CMAKE_INSTALL_LIBDIR}")
else()
get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir)
get_compiler_rt_install_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} install_dir)
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 9b5e03a6607ba..496ef9e97306d 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -377,7 +377,7 @@ macro(load_llvm_config)
file(TO_CMAKE_PATH ${LLVM_CMAKE_DIR_FROM_LLVM_CONFIG} LLVM_CMAKE_DIR)
else()
file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
- set(LLVM_CMAKE_DIR "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ set(LLVM_CMAKE_DIR "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib/cmake/llvm")
endif()
set(LLVM_CMAKE_INCLUDE_FILE "${LLVM_CMAKE_DIR}/LLVMConfig.cmake")
@@ -393,7 +393,7 @@ macro(load_llvm_config)
unset(LLVM_CMAKE_INCLUDE_FILE)
set(LLVM_LIBRARY_OUTPUT_INTDIR
- ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
endif()
# Finally set the cache variable now that `llvm-config` has also had a chance
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index 8a6219568b3f4..e992ed436145e 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -45,7 +45,7 @@ if (LLVM_TREE_AVAILABLE)
# Setup the paths where compiler-rt runtimes and headers should be stored.
set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
- set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
+ set(COMPILER_RT_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}/clang/${CLANG_VERSION}")
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
${LLVM_INCLUDE_TESTS})
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
@@ -97,25 +97,30 @@ if(NOT DEFINED COMPILER_RT_OS_DIR)
string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
endif()
endif()
+
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
${COMPILER_RT_OUTPUT_DIR}/lib)
- extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" lib)
- set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
- "Path where built compiler-rt libraries should be installed.")
-else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ # Don't use "${CMAKE_INSTALL_LIBDIR}", because the intended use-case is that
+ # "${COMPILER_RT_INSTALL_PATH}" is already non-trival and probably includes
+ # "${CMAKE_INSTALL_LIBDIR}".
+ extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "lib")
+else()
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
- extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "lib/${COMPILER_RT_OS_DIR}")
- set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
- "Path where built compiler-rt libraries should be installed.")
+ extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}/${COMPILER_RT_OS_DIR}")
endif()
+set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
+ "Path where built compiler-rt libraries should be installed.")
+
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_BINDIR}")
set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt executables should be installed.")
+
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_INCLUDEDIR}")
set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt headers should be installed.")
+
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_DATADIR}")
set(COMPILER_RT_INSTALL_DATA_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt data files should be installed.")
diff --git a/compiler-rt/docs/BuildingCompilerRT.rst b/compiler-rt/docs/BuildingCompilerRT.rst
index 2ab6f083fc6ab..c62690e94e39d 100644
--- a/compiler-rt/docs/BuildingCompilerRT.rst
+++ b/compiler-rt/docs/BuildingCompilerRT.rst
@@ -79,14 +79,3 @@ Compiler-RT specific options
Path where Compiler-RT data should be installed. If a relative
path, relative to ``COMPILER_RT_INSTALL_PATH``.
-
-.. _LLVM-specific variables:
-
-LLVM-specific options
----------------------
-
-.. option:: LLVM_LIBDIR_SUFFIX:STRING
-
- Extra suffix to append to the directory where libraries are to be
- installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
- to install libraries to ``/usr/lib64``.
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index a0bf269610ce3..424f6fefc082f 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -129,9 +129,9 @@ if (FLANG_STANDALONE_BUILD)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+ ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+ ${CMAKE_BINARY_DIR}/lib)
set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")
set(LLVM_EXTERNAL_LIT "${LLVM_TOOLS_BINARY_DIR}/llvm-lit" CACHE STRING "Command used to spawn lit")
diff --git a/flang/cmake/modules/AddFlang.cmake b/flang/cmake/modules/AddFlang.cmake
index d516ca31b51fa..3eaf00548d327 100644
--- a/flang/cmake/modules/AddFlang.cmake
+++ b/flang/cmake/modules/AddFlang.cmake
@@ -71,8 +71,8 @@ macro(add_flang_library name)
install(TARGETS ${name}
COMPONENT ${name}
${export_to_flangtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if (NOT LLVM_ENABLE_IDE)
diff --git a/flang/cmake/modules/CMakeLists.txt b/flang/cmake/modules/CMakeLists.txt
index 105cc09bf8501..711e706b08d14 100644
--- a/flang/cmake/modules/CMakeLists.txt
+++ b/flang/cmake/modules/CMakeLists.txt
@@ -8,13 +8,13 @@ include(FindPrefixFromConfig)
set(FLANG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/flang" CACHE STRING
"Path for CMake subdirectory for Flang (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/flang')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(flang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/flang")
+set(flang_cmake_builddir "${CMAKE_BINARY_DIR}/lib/cmake/flang")
# Keep this in sync with llvm/cmake/CMakeLists.txt!
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
get_property(FLANG_EXPORTS GLOBAL PROPERTY FLANG_EXPORTS)
export(TARGETS ${FLANG_EXPORTS} FILE ${flang_cmake_builddir}/FlangTargets.cmake)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 8aca93b2cf7cd..4bd7ab69f7131 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.13.4)
+include(GNUInstallDirs)
+
# Default to C++17
set(CMAKE_CXX_STANDARD 17)
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index c5181e92a310c..1aa53a58d6df2 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -5,9 +5,9 @@ add_entrypoint_library(
)
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
- set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
+ set(LIBC_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
else()
- set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX})
+ set(LIBC_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
install(
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index aeaf6b062472a..e3fa1e11e5a9b 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -151,8 +151,6 @@ if (LIBCXX_BENCHMARK_NATIVE_STDLIB)
endif()
option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS})
-set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
- "Define suffix of library directory name (32/64)")
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY
@@ -419,7 +417,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
"Path where built libc++ libraries should be installed.")
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
"Path where target-specific libc++ headers should be installed.")
@@ -432,11 +430,11 @@ else()
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
else()
- set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+ set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib)
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
endif()
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
+ set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH
"Path where built libc++ libraries should be installed.")
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
"Path where target-specific libc++ headers should be installed.")
diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst
index f365aac7e81a8..ae4d0a09a65d3 100644
--- a/libcxx/docs/BuildingLibcxx.rst
+++ b/libcxx/docs/BuildingLibcxx.rst
@@ -235,11 +235,6 @@ libc++ specific options
Build libc++ as a static library. Either `LIBCXX_ENABLE_SHARED` or
`LIBCXX_ENABLE_STATIC` has to be enabled.
-.. option:: LIBCXX_LIBDIR_SUFFIX:STRING
-
- Extra suffix to append to the directory where libraries are to be installed.
- This option overrides `LLVM_LIBDIR_SUFFIX`.
-
.. option:: LIBCXX_HERMETIC_STATIC_LIBRARY:BOOL
**Default**: ``OFF``
@@ -267,7 +262,7 @@ libc++ specific options
.. option:: LIBCXX_INSTALL_LIBRARY_DIR:PATH
- **Default**: ``lib${LIBCXX_LIBDIR_SUFFIX}``
+ **Default**: ``lib``
Path where built libc++ libraries should be installed. If a relative path,
relative to ``CMAKE_INSTALL_PREFIX``.
@@ -430,12 +425,6 @@ The following options allow building libc++ for a
diff erent ABI version.
LLVM-specific options
---------------------
-.. option:: LLVM_LIBDIR_SUFFIX:STRING
-
- Extra suffix to append to the directory where libraries are to be
- installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
- to install libraries to ``/usr/lib64``.
-
.. option:: LLVM_BUILD_32_BITS:BOOL
Build 32-bits executables and libraries on 64-bits systems. This option is
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index b8326d08d23a8..4158c842bdde9 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -74,8 +74,6 @@ if (LIBCXXABI_BUILD_32_BITS)
endif()
option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
-set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
- "Define suffix of library directory name (32/64)")
option(LIBCXXABI_INSTALL_HEADERS "Install the libc++abi headers." ON)
option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
@@ -187,7 +185,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
"Path where built libc++abi libraries should be installed.")
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
@@ -199,9 +197,9 @@ else()
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
else()
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
- set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
+ set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib)
endif()
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH
"Path where built libc++abi libraries should be installed.")
endif()
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 5a06805f05f18..f86555f99de60 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -51,8 +51,6 @@ option(LIBUNWIND_USE_FRAME_HEADER_CACHE "Cache frame headers for unwinding. Requ
option(LIBUNWIND_REMEMBER_HEAP_ALLOC "Use heap instead of the stack for .cfi_remember_state." OFF)
option(LIBUNWIND_INSTALL_HEADERS "Install the libunwind headers." OFF)
-set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
- "Define suffix of library directory name (32/64)")
option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON)
cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY
"Install the static libunwind library." ON
@@ -117,7 +115,7 @@ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
"Path where built libunwind libraries should be installed.")
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
@@ -127,9 +125,9 @@ else()
if(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
else()
- set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib)
endif()
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH
"Path where built libunwind libraries should be installed.")
endif()
diff --git a/libunwind/docs/BuildingLibunwind.rst b/libunwind/docs/BuildingLibunwind.rst
index 79166b4769c61..be2a02799b07b 100644
--- a/libunwind/docs/BuildingLibunwind.rst
+++ b/libunwind/docs/BuildingLibunwind.rst
@@ -144,7 +144,7 @@ libunwind specific options
.. option:: LIBUNWIND_INSTALL_LIBRARY_DIR:PATH
- **Default**: ``lib${LIBUNWIND_LIBDIR_SUFFIX}``
+ **Default**: ``lib``
Path where built libunwind libraries should be installed. If a relative path,
relative to ``CMAKE_INSTALL_PREFIX``.
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index be4ea8540750e..a0a76c689232e 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -30,7 +30,7 @@ if(LLD_BUILT_STANDALONE)
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
include(AddLLVM)
include(TableGen)
diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake
index d3924f7243d40..da046e0c1139c 100644
--- a/lld/cmake/modules/AddLLD.cmake
+++ b/lld/cmake/modules/AddLLD.cmake
@@ -18,8 +18,8 @@ macro(add_lld_library name)
install(TARGETS ${name}
COMPONENT ${name}
${export_to_lldtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
diff --git a/lld/cmake/modules/CMakeLists.txt b/lld/cmake/modules/CMakeLists.txt
index 57195bce45c95..99f668e80f45e 100644
--- a/lld/cmake/modules/CMakeLists.txt
+++ b/lld/cmake/modules/CMakeLists.txt
@@ -8,13 +8,13 @@ include(FindPrefixFromConfig)
set(LLD_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/lld" CACHE STRING
"Path for CMake subdirectory for LLD (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/lld')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(lld_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/lld")
+set(lld_cmake_builddir "${CMAKE_BINARY_DIR}/lib/cmake/lld")
# Keep this in sync with llvm/cmake/CMakeLists.txt!
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
get_property(LLD_EXPORTS GLOBAL PROPERTY LLD_EXPORTS)
export(TARGETS ${LLD_EXPORTS} FILE ${lld_cmake_builddir}/LLDTargets.cmake)
diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake
index 3291a7c808e16..e35e5bce8d9c5 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -109,7 +109,7 @@ function(add_lldb_library name)
endif()
if(PARAM_SHARED)
- set(install_dest lib${LLVM_LIBDIR_SUFFIX})
+ set(install_dest "${CMAKE_INSTALL_LIBDIR}")
if(PARAM_INSTALL_PREFIX)
set(install_dest ${PARAM_INSTALL_PREFIX})
endif()
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 987353517d0d5..281e342b492b5 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -276,7 +276,7 @@ if (NOT TARGET clang-resource-headers)
# could be and pick the first that exists.
foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
"${LLVM_BUILD_LIBRARY_DIR}"
- "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+ "${LLVM_BINARY_DIR}/lib")
# Build the resource directory path by appending 'clang/<version number>'.
set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
if (IS_DIRECTORY "${CANDIDATE_RESOURCE_DIR}")
diff --git a/lldb/cmake/modules/LLDBGenerateConfig.cmake b/lldb/cmake/modules/LLDBGenerateConfig.cmake
index 94332656b28c1..f42f58b32f950 100644
--- a/lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ b/lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -19,6 +19,8 @@ check_cxx_symbol_exists(__NR_process_vm_readv "sys/syscall.h" HAVE_NR_PROCESS_VM
check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
+get_filename_component(LLDB_INSTALL_LIBDIR_BASENAME "${CMAKE_INSTALL_LIBDIR}" NAME)
+
# These checks exist in LLVM's configuration, so I want to match the LLVM names
# so that the check isn't duplicated, but we translate them into the LLDB names
# so that I don't have to change all the uses at the moment.
diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake
index 9cd3f1e8186ba..39530513f6e17 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -76,7 +76,7 @@ endif()
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
@@ -128,5 +128,5 @@ if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake
index c24603f866d6b..14ce46f6559c8 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -51,7 +51,7 @@
#cmakedefine LLDB_PYTHON_HOME R"(${LLDB_PYTHON_HOME})"
-#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
+#define LLDB_INSTALL_LIBDIR_BASENAME "${LLDB_INSTALL_LIBDIR_BASENAME}"
#cmakedefine LLDB_GLOBAL_INIT_DIRECTORY R"(${LLDB_GLOBAL_INIT_DIRECTORY})"
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index dd73ba56afef7..af5a79f492443 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(ExtendPath)
+
get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
if(LLDB_BUILD_FRAMEWORK)
@@ -114,7 +116,8 @@ add_lldb_library(liblldb SHARED ${option_framework}
# (LLVM_LINK_LLVM_DYLIB). Add an additional rpath $ORIGIN/../../../../lib so
# that _lldb.so can be loaded from Python.
if(LLDB_ENABLE_PYTHON AND (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB) AND UNIX AND NOT APPLE)
- set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
+ extend_path(install_rpath "\$ORIGIN/../../../../" "${CMAKE_INSTALL_LIBDIR}")
+ set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${install_rpath}")
endif()
if(Python3_RPATH)
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 712e6983007bb..837b103a64b07 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -175,7 +175,7 @@ bool HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec) {
}
bool HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec) {
- FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins");
+ FileSpec temp_file("/usr/" LLDB_INSTALL_LIBDIR_BASENAME "/lldb/plugins");
FileSystem::Instance().Resolve(temp_file);
file_spec.SetDirectory(temp_file.GetPath());
return true;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
index 1b8ea9adfe808..dd59388cb59e0 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -55,11 +55,11 @@ static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
static const llvm::StringRef kResourceDirSuffixes[] = {
// LLVM.org's build of LLDB uses the clang resource directory placed
// in $install_dir/lib{,64}/clang/$clang_version.
- "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING,
+ CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_STRING,
// swift-lldb uses the clang resource directory copied from swift, which
// by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
- // it there, so we use LLDB_LIBDIR_SUFFIX.
- "lib" LLDB_LIBDIR_SUFFIX "/lldb/clang",
+ // it there, so we use LLDB_INSTALL_LIBDIR_BASENAME.
+ LLDB_INSTALL_LIBDIR_BASENAME "/lldb/clang",
};
for (const auto &Suffix : kResourceDirSuffixes) {
diff --git a/lldb/tools/intel-features/CMakeLists.txt b/lldb/tools/intel-features/CMakeLists.txt
index 7d48491ec89ab..c8a90038cb863 100644
--- a/lldb/tools/intel-features/CMakeLists.txt
+++ b/lldb/tools/intel-features/CMakeLists.txt
@@ -30,4 +30,4 @@ add_lldb_library(lldbIntelFeatures SHARED
)
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
diff --git a/lldb/unittests/Expression/ClangParserTest.cpp b/lldb/unittests/Expression/ClangParserTest.cpp
index 4df557475314e..6c6ddf39f1349 100644
--- a/lldb/unittests/Expression/ClangParserTest.cpp
+++ b/lldb/unittests/Expression/ClangParserTest.cpp
@@ -37,7 +37,8 @@ static std::string ComputeClangResourceDir(std::string lldb_shlib_path,
TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
#if !defined(_WIN32)
std::string path_to_liblldb = "/foo/bar/lib/";
- std::string path_to_clang_dir = "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING;
+ std::string path_to_clang_dir =
+ "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_STRING;
#else
std::string path_to_liblldb = "C:\\foo\\bar\\lib";
std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_STRING;
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index fa1351e425ef5..11b9cdc8a97b8 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -55,6 +55,14 @@ project(LLVM
VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}
LANGUAGES C CXX ASM)
+if (NOT DEFINED CMAKE_INSTALL_LIBDIR AND DEFINED LLVM_LIBDIR_SUFFIX)
+ message(DEPRECATION
+ "\"LLVM_LIBDIR_SUFFIX\" is deprecated. "
+ "Please set \"CMAKE_INSTALL_LIBDIR\" directly instead.")
+ # Must go before `include(GNUInstallDirs)`.
+ set(CMAKE_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
+endif()
+
# Must go after project(..)
include(GNUInstallDirs)
@@ -337,8 +345,6 @@ if (CMAKE_BUILD_TYPE AND
message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()
-set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
-
# LLVM_INSTALL_PACKAGE_DIR needs to be declared prior to adding the tools
# subdirectory in order to have the value available for llvm-config.
include(GNUInstallPackageDir)
@@ -359,7 +365,7 @@ mark_as_advanced(LLVM_EXAMPLES_INSTALL_DIR)
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
@@ -916,8 +922,8 @@ configure_file(
# They are not referenced. See set_output_directory().
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
-set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
-set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
+set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
+set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
if(LLVM_INCLUDE_TESTS)
include(GetErrcMessages)
@@ -975,7 +981,7 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
install(TARGETS tf_xla_runtime EXPORT LLVMExports
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime)
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT tf_xla_runtime)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime)
# Once we add more modules, we should handle this more automatically.
if (DEFINED LLVM_OVERRIDE_MODEL_HEADER_INLINERSIZEMODEL)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 057431208322e..22068c221ca6e 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -844,8 +844,8 @@ macro(add_llvm_library name)
get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella})
install(TARGETS ${name}
${export_to_llvmexports}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT ${name}
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT ${name}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
if (NOT LLVM_ENABLE_IDE)
@@ -1093,7 +1093,7 @@ function(process_llvm_pass_plugins)
message(FATAL_ERROR "LLVM_INSTALL_PACKAGE_DIR must be defined and writable. GEN_CONFIG should only be passe when building LLVM proper.")
endif()
# LLVM_INSTALL_PACKAGE_DIR might be absolute, so don't reuse below.
- set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
file(WRITE
"${llvm_cmake_builddir}/LLVMConfigExtensions.cmake"
"set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
@@ -2007,7 +2007,7 @@ function(llvm_install_library_symlink name dest type)
set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
+ set(output_dir "${CMAKE_INSTALL_FULL_LIBDIR}")
if(WIN32 AND "${type}" STREQUAL "SHARED")
set(output_dir "${CMAKE_INSTALL_BINDIR}")
endif()
@@ -2271,15 +2271,15 @@ function(llvm_setup_rpath name)
if (APPLE)
set(_install_name_dir INSTALL_NAME_DIR "@rpath")
- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS)
# $ORIGIN is not interpreted at link time by aix ld.
# Since BUILD_SHARED_LIBS is only recommended for use by developers,
# hardcode the rpath to build/install lib dir first in this mode.
# FIXME: update this when there is better solution.
- set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_FULL_LIBDIR}" ${extra_libdir})
elseif(UNIX)
- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-z,origin ")
diff --git a/llvm/cmake/modules/AddOCaml.cmake b/llvm/cmake/modules/AddOCaml.cmake
index 891c9e6d618c0..59c2b3acf391c 100644
--- a/llvm/cmake/modules/AddOCaml.cmake
+++ b/llvm/cmake/modules/AddOCaml.cmake
@@ -147,9 +147,9 @@ function(add_ocaml_library name)
endforeach()
if( APPLE )
- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
+ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}")
elseif( UNIX )
- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
+ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}")
endif()
list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
index 470881516915a..ea52a95e62388 100644
--- a/llvm/cmake/modules/CMakeLists.txt
+++ b/llvm/cmake/modules/CMakeLists.txt
@@ -3,7 +3,7 @@ include(LLVMDistributionSupport)
include(FindPrefixFromConfig)
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
# First for users who use an installed LLVM, create the LLVMExports.cmake file.
set(LLVM_EXPORTS_FILE ${llvm_cmake_builddir}/LLVMExports.cmake)
@@ -125,7 +125,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS
)
list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS)
-extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "lib\${LLVM_LIBDIR_SUFFIX}")
+extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "${CMAKE_INSTALL_LIBDIR}")
set(LLVM_CONFIG_LIBRARY_DIRS
"${LLVM_CONFIG_LIBRARY_DIR}"
# FIXME: Should there be other entries here?
diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index fbf28d36bedf4..65c86d8cca245 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -104,8 +104,6 @@ set(LLVM_PLUGIN_EXT @LLVM_PLUGIN_EXT@)
set(LLVM_ON_UNIX @LLVM_ON_UNIX@)
-set(LLVM_LIBDIR_SUFFIX @LLVM_LIBDIR_SUFFIX@)
-
set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
@@ -120,6 +118,14 @@ set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
set(LLVM_MAIN_INCLUDE_DIR "@LLVM_CONFIG_MAIN_INCLUDE_DIR@")
set(LLVM_LIBRARY_DIR "@LLVM_CONFIG_LIBRARY_DIR@")
+# Backwards compatibility for anything using the deprecated `LLVM_LIBDIR_SUFFIX`
+# downstream.
+if("{LLVM_LIBRARY_DIR}" MATCHES "lib([^/]*)$")
+ set(LLVM_LIBDIR_SUFFIX "${CMAKE_MATCH_0}")
+else()
+ set(LLVM_LIBDIR_SUFFIX "")
+endif()
+
# This is a secondary one for generated files
set(LLVM_INCLUDE_DIR "@LLVM_CONFIG_INCLUDE_DIR@")
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 879b7b231d4cf..b173207b7a242 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -247,11 +247,6 @@ description is in `LLVM-related variables`_ below.
Control which runtimes are enabled. For example you may want to work on
libc++ or libc++abi by specifying ``-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"``.
-**LLVM_LIBDIR_SUFFIX**:STRING
- Extra suffix to append to the directory where libraries are to be
- installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
- to install libraries to ``/usr/lib64``.
-
**LLVM_PARALLEL_{COMPILE,LINK}_JOBS**:STRING
Building the llvm toolchain can use a lot of resources, particularly
linking. These options, when you use the Ninja generator, allow you
@@ -284,6 +279,10 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``.
The path to install executables, relative to the *CMAKE_INSTALL_PREFIX*.
Defaults to "bin".
+**CMAKE_INSTALL_LIBDIR**:PATH
+ The path to install libraries, relative to the *CMAKE_INSTALL_PREFIX*.
+ Defaults to "lib".
+
**CMAKE_INSTALL_INCLUDEDIR**:PATH
The path to install header files, relative to the *CMAKE_INSTALL_PREFIX*.
Defaults to "include".
@@ -831,6 +830,21 @@ things to go wrong. They are also unstable across LLVM versions.
Only matters if *LLVM_BUILD_EXAMPLES* is enabled.
Defaults to "examples".
+Deprecated variables
+~~~~~~~~~~~~~~~~~~~~
+
+These will go away soon. Please try to avoid using them.
+
+**LLVM_LIBDIR_SUFFIX**:STRING
+
+ **Deprecated**: Use ``LLVM_LIBRARY_DIR`` or ``CMAKE_INSTALL_LIBDIR`` instead.
+ Only defined downstream for legacy consumers, not during the build of LLVM
+ itself.
+
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
CMake Caches
============
diff --git a/llvm/tools/llvm-config/BuildVariables.inc.in b/llvm/tools/llvm-config/BuildVariables.inc.in
index 370005cd8d7d0..1b0c5d327b352 100644
--- a/llvm/tools/llvm-config/BuildVariables.inc.in
+++ b/llvm/tools/llvm-config/BuildVariables.inc.in
@@ -22,7 +22,7 @@
#define LLVM_LDFLAGS "@LLVM_LDFLAGS@"
#define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
#define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
-#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
#define LLVM_INSTALL_PACKAGE_DIR "@LLVM_INSTALL_PACKAGE_DIR@"
#define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
index 18958e8be45f7..afcd382658e6a 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -339,18 +339,16 @@ int main(int argc, char **argv) {
switch (DevelopmentTreeLayout) {
case CMakeStyle:
ActiveBinDir = ActiveObjRoot + "/bin";
- ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
+ ActiveLibDir = ActiveObjRoot + "/lib";
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
break;
case CMakeBuildModeStyle:
// FIXME: Should we consider the build-mode-specific path as the prefix?
ActivePrefix = ActiveObjRoot;
ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin";
- ActiveLibDir =
- ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX;
+ ActiveLibDir = ActiveObjRoot + "/" + build_mode + "/lib";
// The CMake directory isn't separated by build mode.
- ActiveCMakeDir =
- ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX + "/cmake/llvm";
+ ActiveCMakeDir = ActivePrefix + "/lib/cmake/llvm";
break;
}
@@ -369,7 +367,11 @@ int main(int argc, char **argv) {
sys::fs::make_absolute(ActivePrefix, Path);
ActiveBinDir = std::string(Path.str());
}
- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+ {
+ SmallString<256> Path(LLVM_INSTALL_LIBDIR);
+ sys::fs::make_absolute(ActivePrefix, Path);
+ ActiveLibDir = std::string(Path.str());
+ }
{
SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR);
sys::fs::make_absolute(ActivePrefix, Path);
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index 8e2b78f1b85c0..07bde6da8ff4a 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -88,7 +88,7 @@ if(LLVM_BUILD_LLVM_C_DYLIB AND NOT MSVC)
set(LLVM_EXPORTED_SYMBOL_FILE ${LLVM_BINARY_DIR}/libllvm-c.exports)
- set(LIB_DIR ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ set(LIB_DIR ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
set(LIB_NAME ${LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}LLVM)
set(LIB_PATH ${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIB_EXPORTS_PATH ${LIB_NAME}.exports)
diff --git a/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn b/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
index 1d598d913501b..9069d4d500114 100644
--- a/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -19,7 +19,6 @@ write_cmake_config("Config") {
"CLANG_DEFAULT_OPENMP_RUNTIME=libomp",
"CLANG_DEFAULT_UNWINDLIB=",
"CLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_35",
- "CLANG_LIBDIR_SUFFIX=",
"CLANG_RESOURCE_DIR=",
"C_INCLUDE_DIRS=",
"CLANG_CONFIG_FILE_SYSTEM_DIR=",
diff --git a/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn b/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
index 2df3cb3e3a4fa..19495263c9ebf 100644
--- a/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
@@ -25,8 +25,6 @@ write_cmake_config("Config") {
"LLDB_PYTHON_HOME=",
- "LLVM_LIBDIR_SUFFIX=",
-
"HAVE_LIBCOMPRESSION=",
]
diff --git a/llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
index 35e835d6db880..8981bc47d6a47 100644
--- a/llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
@@ -71,6 +71,7 @@ write_cmake_config("BuildVariables.inc") {
}
values = [
+ "CMAKE_INSTALL_LIBDIR=lib",
"CMAKE_INSTALL_INCLUDEDIR=include",
"LLVM_SRC_ROOT=" + rebase_path("//llvm"),
"LLVM_OBJ_ROOT=" + rebase_path(root_out_dir),
@@ -81,7 +82,6 @@ write_cmake_config("BuildVariables.inc") {
"LLVM_LDFLAGS=.", # FIXME
"LLVM_CXXFLAGS=.", # FIXME
"LLVM_BUILDMODE=$build_mode",
- "LLVM_LIBDIR_SUFFIX=",
"LLVM_TARGETS_BUILT=$llvm_targets_to_build_string",
"LLVM_SYSTEM_LIBS=$system_libs",
"LLVM_BUILD_SYSTEM=gn",
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index ac98cc290a0bd..a061f80bb47d8 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -28,7 +28,7 @@ if(MLIR_STANDALONE_BUILD)
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+ "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
endif()
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 15079eea3009c..6b91e403b3d37 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -533,13 +533,13 @@ function(add_mlir_library_install name)
install(TARGETS ${name}
COMPONENT ${name}
${export_to_mlirtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
# Note that CMake will create a directory like:
# objects-${CMAKE_BUILD_TYPE}/obj.LibName
# and put object files there.
- OBJECTS DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ OBJECTS DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
if (NOT LLVM_ENABLE_IDE)
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 706413776b9e5..11d0871ce853f 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -408,8 +408,12 @@ function(mlir_python_setup_extension_rpath target)
get_filename_component(_real_lib_dir "${LLVM_LIBRARY_OUTPUT_INTDIR}" REALPATH)
set_property(TARGET ${target} APPEND PROPERTY
BUILD_RPATH "${_real_lib_dir}")
- set_property(TARGET ${target} APPEND PROPERTY
- INSTALL_RPATH "${_origin_prefix}/${ARG_RELATIVE_INSTALL_ROOT}/lib${LLVM_LIBDIR_SUFFIX}")
+ if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
+ set(install_rpath "${_origin_prefix}/${ARG_RELATIVE_INSTALL_ROOT}/${CMAKE_INSTALL_LIBDIR}")
+ else()
+ set(install_rpath "${CMAKE_INSTALL_LIBDIR}")
+ endif()
+ set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${install_rpath}")
endif()
endfunction()
diff --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt
index 5fd9454cad93e..f4d3f7085e712 100644
--- a/mlir/cmake/modules/CMakeLists.txt
+++ b/mlir/cmake/modules/CMakeLists.txt
@@ -9,13 +9,13 @@ include(FindPrefixFromConfig)
set(MLIR_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/mlir" CACHE STRING
"Path for CMake subdirectory for Polly (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/polly')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir")
+set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/lib/cmake/mlir")
# Keep this in sync with llvm/cmake/CMakeLists.txt!
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS)
export(TARGETS ${MLIR_EXPORTS} FILE ${mlir_cmake_builddir}/MLIRTargets.cmake)
diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt
index 74f805865d2d3..b2bc8bc23c166 100644
--- a/mlir/test/CMakeLists.txt
+++ b/mlir/test/CMakeLists.txt
@@ -8,7 +8,7 @@ endif()
# Passed to lit.site.cfg.py.so that the out of tree Standalone dialect test
# can find MLIR's CMake configuration
set(MLIR_CMAKE_DIR
- "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir")
+ "${CMAKE_BINARY_DIR}/lib/cmake/mlir")
# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
# for linalg integration tests.
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index dd860485c69d9..a69245aa7cf4f 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -17,6 +17,9 @@ endif()
# Must go below project(..)
include(GNUInstallDirs)
+set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" CACHE STRING
+ "lib installation directory, e.g. lib or lib64")
+
if (OPENMP_STANDALONE_BUILD)
# CMAKE_BUILD_TYPE was not set, default to Release.
if (NOT CMAKE_BUILD_TYPE)
@@ -26,10 +29,6 @@ if (OPENMP_STANDALONE_BUILD)
# Group common settings.
set(OPENMP_ENABLE_WERROR FALSE CACHE BOOL
"Enable -Werror flags to turn warnings into errors for supporting compilers.")
- set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING
- "Suffix of lib installation directory, e.g. 64 => lib64")
- # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
# Group test settings.
set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
@@ -39,8 +38,6 @@ if (OPENMP_STANDALONE_BUILD)
set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
else()
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
- # If building in tree, we honor the same install suffix LLVM uses.
- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
if (NOT MSVC)
set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
diff --git a/openmp/README.rst b/openmp/README.rst
index ffa49e4d2a49d..b31a431f395d3 100644
--- a/openmp/README.rst
+++ b/openmp/README.rst
@@ -108,8 +108,8 @@ Options for all Libraries
**OPENMP_ENABLE_WERROR** = ``OFF|ON``
Treat warnings as errors and fail, if a compiler warning is triggered.
-**OPENMP_LIBDIR_SUFFIX** = ``""``
- Extra suffix to append to the directory where libraries are to be installed.
+**OPENMP_INSTALL_LIBDIR** = ``lib``
+ Name or path of the directory where libraries are to be installed.
**OPENMP_TEST_C_COMPILER** = ``${CMAKE_C_COMPILER}``
Compiler to use for testing. Defaults to the compiler that was also used for
diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt
index 4c528d562e23b..34186e4d0edfd 100644
--- a/polly/cmake/CMakeLists.txt
+++ b/polly/cmake/CMakeLists.txt
@@ -7,12 +7,12 @@ include(FindPrefixFromConfig)
set(POLLY_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/polly" CACHE STRING
"Path for CMake subdirectory for Polly (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/polly')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(polly_cmake_builddir "${POLLY_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
+set(polly_cmake_builddir "${POLLY_BINARY_DIR}/lib/cmake/polly")
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib/cmake/llvm")
if (CMAKE_CONFIGURATION_TYPES)
set(POLLY_EXPORTS_FILE_NAME "PollyExports-$<LOWER_CASE:$<CONFIG>>.cmake")
@@ -93,7 +93,7 @@ unset(POLLY_EXPORTS)
find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
-extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_LIBDIR}")
extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
if (POLLY_BUNDLED_ISL)
set(POLLY_CONFIG_INCLUDE_DIRS
diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake
index 518a09b45a420..afc8e07087501 100644
--- a/polly/cmake/polly_macros.cmake
+++ b/polly/cmake/polly_macros.cmake
@@ -44,8 +44,8 @@ macro(add_polly_library name)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
install(TARGETS ${name}
EXPORT LLVMExports
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endmacro(add_polly_library)
diff --git a/polly/test/CMakeLists.txt b/polly/test/CMakeLists.txt
index 358d7a561225a..45cd2a66deaf6 100644
--- a/polly/test/CMakeLists.txt
+++ b/polly/test/CMakeLists.txt
@@ -46,7 +46,7 @@ endif ()
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
-set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib")
if (CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(POLLY_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
else()
diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt
index 2461522349ee0..60b080da144fc 100644
--- a/pstl/CMakeLists.txt
+++ b/pstl/CMakeLists.txt
@@ -88,10 +88,10 @@ install(TARGETS ParallelSTL
install(EXPORT ParallelSTLTargets
FILE ParallelSTLTargets.cmake
NAMESPACE pstl::
- DESTINATION lib/cmake/ParallelSTL)
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ParallelSTL")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
- DESTINATION lib/cmake/ParallelSTL)
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ParallelSTL")
install(DIRECTORY include/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
PATTERN "*.in" EXCLUDE)
diff --git a/third-party/benchmark/src/CMakeLists.txt b/third-party/benchmark/src/CMakeLists.txt
index e814a4e00f7c2..7140e8f049723 100644
--- a/third-party/benchmark/src/CMakeLists.txt
+++ b/third-party/benchmark/src/CMakeLists.txt
@@ -79,7 +79,7 @@ include(CMakePackageConfigHelpers)
configure_package_config_file (
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
${project_config}
- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
+ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
@@ -100,8 +100,8 @@ if (BENCHMARK_ENABLE_INSTALL)
install(
TARGETS ${targets_to_export}
EXPORT ${targets_export_name}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
diff --git a/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h b/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
index dc1d7d57581b3..aea09101d0e26 100644
--- a/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
+++ b/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
@@ -67,8 +67,8 @@
/* Default architecture for SystemZ. */
#define CLANG_SYSTEMZ_DEFAULT_ARCH "z10"
-/* Multilib suffix for libdir. */
-#define CLANG_LIBDIR_SUFFIX ""
+/* Multilib basename for libdir. */
+#define CLANG_INSTALL_LIBDIR_BASENAME "lib"
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR ""
More information about the Openmp-commits
mailing list