forked from mirrors/nixpkgs
e0d3c9d031
This decision was made in a902d99422
but
just for LLVM 12. Now we apply it consitently.
101 lines
4.9 KiB
Diff
101 lines
4.9 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 910d04b54b6d..80ef692d83eb 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -31,6 +31,8 @@ set(CMAKE_MODULE_PATH
|
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
|
|
project(libcxx CXX C)
|
|
|
|
+ include(GNUInstallDirs)
|
|
+
|
|
set(PACKAGE_NAME libcxx)
|
|
set(PACKAGE_VERSION 11.1.0)
|
|
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
|
@@ -418,7 +420,7 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
|
|
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
|
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
|
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
|
|
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
|
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
|
if(LIBCXX_LIBDIR_SUBDIR)
|
|
string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
|
|
string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
|
|
@@ -426,11 +428,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
|
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
|
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
|
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
|
|
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
|
|
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
|
|
else()
|
|
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
|
set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR})
|
|
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
|
|
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
|
|
endif()
|
|
|
|
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
|
|
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
|
|
index c5aa26739e36..8841c4a5252d 100644
|
|
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
|
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
|
@@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
|
|
|
|
if (LIBCXX_INSTALL_HEADERS)
|
|
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
|
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
|
|
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
|
|
COMPONENT cxx-headers
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
)
|
|
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
|
index be8141c98166..93847e5758cc 100644
|
|
--- a/include/CMakeLists.txt
|
|
+++ b/include/CMakeLists.txt
|
|
@@ -257,7 +257,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
|
foreach(file ${files})
|
|
get_filename_component(dir ${file} DIRECTORY)
|
|
install(FILES ${file}
|
|
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
|
|
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
|
|
COMPONENT ${CXX_HEADER_TARGET}
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
)
|
|
@@ -265,7 +265,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
|
|
|
# Install the generated header as __config.
|
|
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
|
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
|
|
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
RENAME __config
|
|
COMPONENT ${CXX_HEADER_TARGET})
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 2001c09761d9..5bd11ea6b400 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -344,21 +344,21 @@ if (LIBCXX_INSTALL_LIBRARY)
|
|
install(TARGETS cxx_shared
|
|
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
|
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
|
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
|
|
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
|
endif()
|
|
|
|
if (LIBCXX_INSTALL_STATIC_LIBRARY)
|
|
install(TARGETS cxx_static
|
|
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
|
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
|
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
|
|
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
|
endif()
|
|
|
|
if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
|
|
install(TARGETS cxx_experimental
|
|
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
|
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
|
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
|
|
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
|
endif()
|
|
|
|
# NOTE: This install command must go after the cxx install command otherwise
|