diff options
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/CMakeLists.txt | 20 | ||||
-rw-r--r-- | libcxx/cmake/Modules/HandleLibCXXABI.cmake | 2 | ||||
-rw-r--r-- | libcxx/include/CMakeLists.txt | 6 |
3 files changed, 19 insertions, 9 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 53ad1ffeaa3..b6b8babad8f 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -378,20 +378,30 @@ endif () set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") -if (LLVM_LIBRARY_OUTPUT_INTDIR) + +string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + ${PACKAGE_VERSION}) + +if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) + set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) + set(DEFAULT_INSTALL_HEADER_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/) + set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}) + set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) +elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) endif() + file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") -set(LIBCXX_INSTALL_PREFIX "" CACHE STRING +set(LIBCXX_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING "Define libc++ destination prefix.") -if (NOT LIBCXX_INSTALL_PREFIX MATCHES "^$|.*/") - message(FATAL_ERROR "LIBCXX_INSTALL_PREFIX has to end with \"/\".") -endif() +set(LIBCXX_INSTALL_HEADER_PREFIX ${DEFAULT_INSTALL_HEADER_PREFIX} CACHE STRING + "Define libc++ header destination prefix.") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake index e3a8d022415..797b504ebaf 100644 --- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake +++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake @@ -65,7 +65,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs) if (LIBCXX_INSTALL_HEADERS) install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}" - DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir} + DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dstdir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 90f6dcf6bed..91e256331a7 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -204,7 +204,7 @@ else() endif() if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR) - set(output_dir ${LLVM_BINARY_DIR}/include/c++/v1) + set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1) set(out_files) foreach(f ${files}) @@ -238,7 +238,7 @@ if (LIBCXX_INSTALL_HEADERS) foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) @@ -247,7 +247,7 @@ if (LIBCXX_INSTALL_HEADERS) if (LIBCXX_NEEDS_SITE_CONFIG) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1 + DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ RENAME __config COMPONENT cxx-headers) |