diff --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt index 1716c53b031e..61b1c60bf590 100644 --- a/clang/runtime/CMakeLists.txt +++ b/clang/runtime/CMakeLists.txt @@ -82,7 +82,7 @@ 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:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} + -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake index 1e9e7c58664b..bc69ec95c419 100644 --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -371,7 +371,7 @@ function(add_compiler_rt_runtime name type) add_custom_command(TARGET ${libname} POST_BUILD COMMAND codesign --sign - $ - WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} + WORKING_DIRECTORY ${COMPILER_RT_OUTPUT_LIBRARY_DIR} ) endif() endif() @@ -511,7 +511,7 @@ macro(add_compiler_rt_resource_file target_name file_name component) add_custom_target(${target_name} DEPENDS ${dst_file}) # Install in Clang resource directory. install(FILES ${file_name} - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share + DESTINATION ${COMPILER_RT_INSTALL_DATA_DIR} COMPONENT ${component}) add_dependencies(${component} ${target_name}) @@ -528,7 +528,7 @@ macro(add_compiler_rt_script name) add_custom_target(${name} DEPENDS ${dst}) install(FILES ${dst} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin) + DESTINATION ${COMPILER_RT_INSTALL_BINARY_DIR}) endmacro(add_compiler_rt_script src name) # Builds custom version of libc++ and installs it in . diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake index a38ad8c55af0..380ae031a0fe 100644 --- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake @@ -457,8 +457,8 @@ macro(darwin_add_builtin_libraries) PARENT_TARGET builtins LIPO_FLAGS ${${os}_cc_kext_lipo_flags} DEPENDS ${${os}_cc_kext_libs} - OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR} - INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR}) + OUTPUT_DIR ${COMPILER_RT_OUTPUT_LIBRARY_DIR} + INSTALL_DIR ${COMPILER_RT_INSTALL_LIBRARY_DIR}) endif() endforeach() @@ -467,8 +467,8 @@ macro(darwin_add_builtin_libraries) PARENT_TARGET builtins LIPO_FLAGS ${${os}_builtins_lipo_flags} DEPENDS ${${os}_builtins_libs} - OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR} - INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR}) + OUTPUT_DIR ${COMPILER_RT_OUTPUT_LIBRARY_DIR} + INSTALL_DIR ${COMPILER_RT_INSTALL_LIBRARY_DIR}) endforeach() darwin_add_embedded_builtin_libraries() endmacro() @@ -506,9 +506,9 @@ macro(darwin_add_embedded_builtin_libraries) set(DARWIN_macho_embedded_ARCHS armv6m armv7m armv7em armv7 i386 x86_64) set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR - ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded) + ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/macho_embedded) set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded) + ${COMPILER_RT_INSTALL_LIBRARY_DIR}/macho_embedded) set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi") set(CFLAGS_i386 "-march=pentium") diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index 88ee021fe68c..5543e3c6afc6 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -498,18 +498,18 @@ endfunction() function(get_compiler_rt_install_dir arch install_dir) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) - set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE) + set(${install_dir} ${COMPILER_RT_INSTALL_LIBRARY_DIR}/${target} PARENT_SCOPE) else() - set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE) + set(${install_dir} ${COMPILER_RT_INSTALL_LIBRARY_DIR} PARENT_SCOPE) endif() endfunction() function(get_compiler_rt_output_dir arch output_dir) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) - set(${output_dir} ${COMPILER_RT_OUTPUT_DIR}/lib/${target} PARENT_SCOPE) + set(${output_dir} ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/${target} PARENT_SCOPE) else() - set(${output_dir} ${COMPILER_RT_LIBRARY_OUTPUT_DIR} PARENT_SCOPE) + set(${output_dir} ${COMPILER_RT_OUTPUT_LIBRARY_DIR} PARENT_SCOPE) endif() endfunction() diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake index 1edab43e7c0d..c11342e68813 100644 --- a/compiler-rt/cmake/base-config-ix.cmake +++ b/compiler-rt/cmake/base-config-ix.cmake @@ -68,8 +68,8 @@ else() "Path where built compiler-rt libraries should be stored.") set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH "Path where built compiler-rt executables should be stored.") - set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH - "Path where built compiler-rt libraries should be installed.") + set(COMPILER_RT_INSTALL_PATH "" CACHE PATH + "Prefix for directories where built compiler-rt artifacts should be installed.") option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF) option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF) # Use a host compiler to compile/link tests. @@ -85,20 +85,45 @@ else() set(COMPILER_RT_TEST_COMPILER_ID GNU) endif() +function(extend_install_path joined_path current_segment) + if("${current_segment}" STREQUAL "") + set(temp_path "${COMPILER_RT_INSTALL_PATH}") + elseif("${COMPILER_RT_INSTALL_PATH}" STREQUAL "") + set(temp_path "${current_segment}") + elseif(IS_ABSOLUTE "${current_segment}") + message(WARNING "Since \"${current_segment}\" is absolute, it overrides COMPILER_RT_INSTALL_PATH: \"${COMPILER_RT_INSTALL_PATH}\".") + set(temp_path "${current_segment}") + else() + set(temp_path "${COMPILER_RT_INSTALL_PATH}/${current_segment}") + endif() + set(${joined_path} "${temp_path}" PARENT_SCOPE) +endfunction() + if(NOT DEFINED COMPILER_RT_OS_DIR) string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR) endif() if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(COMPILER_RT_LIBRARY_OUTPUT_DIR - ${COMPILER_RT_OUTPUT_DIR}) - set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}) -else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) - set(COMPILER_RT_LIBRARY_OUTPUT_DIR + set(COMPILER_RT_OUTPUT_LIBRARY_DIR + ${COMPILER_RT_OUTPUT_DIR}/lib) + extend_install_path(default_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) + set(COMPILER_RT_OUTPUT_LIBRARY_DIR ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) - set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) + extend_install_path(default_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.") endif() +extend_install_path(default_install_path bin) +set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH + "Path where built compiler-rt executables should be installed.") +extend_install_path(default_install_path include) +set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH + "Path where compiler-rt headers should be installed.") +extend_install_path(default_install_path share) +set(COMPILER_RT_INSTALL_DATA_DIR "${default_install_path}" CACHE PATH + "Path where compiler-rt data files should be installed.") if(APPLE) # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but diff --git a/compiler-rt/docs/BuildingCompilerRT.rst b/compiler-rt/docs/BuildingCompilerRT.rst new file mode 100644 index 000000000000..2ab6f083fc6a --- /dev/null +++ b/compiler-rt/docs/BuildingCompilerRT.rst @@ -0,0 +1,92 @@ +.. _BuildingCompilerRT: + +=============== +Building Compiler-RT +=============== + +.. contents:: + :local: + +.. _build instructions: + +The instructions on this page are aimed at vendors who ship Compiler-RT as part of an +operating system distribution, a toolchain or similar shipping vehicules. If you +are a user merely trying to use Compiler-RT in your program, you most likely want to +refer to your vendor's documentation, or to the general documentation for using +LLVM, Clang, the various santizers, etc. + +CMake Options +============= + +Here are some of the CMake variables that are used often, along with a +brief explanation and LLVM-specific notes. For full documentation, check the +CMake docs or execute ``cmake --help-variable VARIABLE_NAME``. + +**CMAKE_BUILD_TYPE**:STRING + Sets the build type for ``make`` based generators. Possible values are + Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio + the user sets the build type with the IDE settings. + +**CMAKE_INSTALL_PREFIX**:PATH + Path where LLVM will be installed if "make install" is invoked or the + "INSTALL" target is built. + +**CMAKE_CXX_COMPILER**:STRING + The C++ compiler to use when building and testing Compiler-RT. + + +.. _compiler-rt-specific options: + +Compiler-RT specific options +----------------------- + +.. option:: COMPILER_RT_INSTALL_PATH:PATH + + **Default**: ```` (empty relative path) + + Prefix for directories where built Compiler-RT artifacts should be installed. + Can be an absolute path, like the default empty string, in which case it is + relative ``CMAKE_INSTALL_PREFIX``. If setting a relative path, make sure to + include the ``:PATH`` with your ``-D``, i.e. use + ``-DCOMPILER_RT_INSTALL_PATH:PATH=...`` not + ``-DCOMPILER_RT_INSTALL_PATH=...``, otherwise CMake will convert the + path to an absolute path. + +.. option:: COMPILER_RT_INSTALL_LIBRARY_DIR:PATH + + **Default**: ``lib`` + + Path where built Compiler-RT libraries should be installed. If a relative + path, relative to ``COMPILER_RT_INSTALL_PATH``. + +.. option:: COMPILER_RT_INSTALL_BINARY_DIR:PATH + + **Default**: ``bin`` + + Path where built Compiler-RT executables should be installed. If a relative + path, relative to ``COMPILER_RT_INSTALL_PATH``. + +.. option:: COMPILER_RT_INSTALL_INCLUDE_DIR:PATH + + **Default**: ``include`` + + Path where Compiler-RT headers should be installed. If a relative + path, relative to ``COMPILER_RT_INSTALL_PATH``. + +.. option:: COMPILER_RT_INSTALL_DATA_DIR:PATH + + **Default**: ``share`` + + 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/compiler-rt/include/CMakeLists.txt b/compiler-rt/include/CMakeLists.txt index b00e8caa1ddd..7b415f0b88a3 100644 --- a/compiler-rt/include/CMakeLists.txt +++ b/compiler-rt/include/CMakeLists.txt @@ -69,22 +69,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc") install(FILES ${SANITIZER_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer) + DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer) # Install fuzzer headers. install(FILES ${FUZZER_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer) + DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/fuzzer) # Install xray headers. install(FILES ${XRAY_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray) + DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/xray) # Install profile headers. install(FILES ${PROFILE_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile) + DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/profile) if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs. add_custom_target(install-compiler-rt-headers diff --git a/compiler-rt/lib/dfsan/CMakeLists.txt b/compiler-rt/lib/dfsan/CMakeLists.txt index b06ae472f073..45cb9c97e2eb 100644 --- a/compiler-rt/lib/dfsan/CMakeLists.txt +++ b/compiler-rt/lib/dfsan/CMakeLists.txt @@ -65,4 +65,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename} DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) add_dependencies(dfsan dfsan_abilist) install(FILES ${dfsan_abilist_filename} - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share) + DESTINATION ${COMPILER_RT_INSTALL_DATA_DIR}) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index ab1a5b5361a7..654bed5de88c 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -407,9 +407,12 @@ 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}) - set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1") - set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1") + set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH + "Path where built libc++ libraries should be installed.") + set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH + "Path where target-agnostic libc++ headers should be installed.") + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH + "Path where target-specific libc++ headers should be installed.") if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) @@ -418,16 +421,22 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}") - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) - set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1") - set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}") + set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH + "Path where built libc++ libraries should be installed.") + set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH + "Path where target-agnostic libc++ headers should be installed.") + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH + "Path where target-specific libc++ headers should be installed.") else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1") set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}") - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) - set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1") - set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}") + set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH + "Path where built libc++ libraries should be installed.") + set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH + "Path where target-agnostic libc++ headers should be installed.") + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH + "Path where target-specific libc++ headers should be installed.") endif() file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst index 629e4c8355ba..34e82f2bc01d 100644 --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -251,6 +251,28 @@ libc++ specific options This option can be used to enable or disable the filesystem components on platforms that may not support them. For example on Windows. +.. option:: LIBCXX_INSTALL_LIBRARY_DIR:PATH + + **Default**: ``lib${LIBCXX_LIBDIR_SUFFIX}`` + + Path where built libc++ libraries should be installed. If a relative path, + relative to ``CMAKE_INSTALL_PREFIX``. + +.. option:: LIBCXX_INSTALL_INCLUDE_DIR:PATH + + **Default**: ``include/c++/v1`` + + Path where target-agnostic libc++ headers should be installed. If a relative + path, relative to ``CMAKE_INSTALL_PREFIX``. + +.. option:: LIBCXX_INSTALL_INCLUDE_TARGET_DIR:PATH + + **Default**: ``include/c++/v1`` or + ``include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1`` + + Path where target-specific libc++ headers should be installed. If a relative + path, relative to ``CMAKE_INSTALL_PREFIX``. + .. _libc++experimental options: libc++experimental Specific Options diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 9bd81075dd14..584bcbd2adde 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -195,7 +195,8 @@ set(CMAKE_MODULE_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}) + set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${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}) string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) @@ -203,11 +204,13 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR}) set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX}) + set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH + "Path where built libc++abi libraries should be installed.") else() set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR}) set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX}) - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX}) + set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH + "Path where built libc++abi libraries should be installed.") endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR}) diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index a2c03fd3f8aa..9eada6895e00 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -116,17 +116,20 @@ set(CMAKE_MODULE_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}) + set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${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}) string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) endif() elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX}) + set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH + "Path where built libunwind libraries should be installed.") else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX}) + set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH + "Path where built libunwind libraries should be installed.") endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) diff --git a/libunwind/docs/BuildingLibunwind.rst b/libunwind/docs/BuildingLibunwind.rst index ad9dee0519a8..9b11042a6581 100644 --- a/libunwind/docs/BuildingLibunwind.rst +++ b/libunwind/docs/BuildingLibunwind.rst @@ -159,3 +159,10 @@ libunwind specific options .. option:: LIBUNWIND_SYSROOT Sysroot for cross compiling + +.. option:: LIBUNWIND_INSTALL_LIBRARY_DIR:PATH + + **Default**: ``lib${LIBUNWIND_LIBDIR_SUFFIX}`` + + Path where built libunwind libraries should be installed. If a relative path, + relative to ``CMAKE_INSTALL_PREFIX``.