summaryrefslogtreecommitdiff
path: root/cmake/Modules/HandleLibCXXABI.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Modules/HandleLibCXXABI.cmake')
-rw-r--r--cmake/Modules/HandleLibCXXABI.cmake43
1 files changed, 24 insertions, 19 deletions
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
index 558e11ba2cc1..ef3b4f5dde22 100644
--- a/cmake/Modules/HandleLibCXXABI.cmake
+++ b/cmake/Modules/HandleLibCXXABI.cmake
@@ -32,14 +32,6 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
set(LIBCXX_ABILIB_FILES ${abifiles})
- # The place in the build tree where we store out-of-source headers.
- file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
- file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
- foreach(_d ${abidirs})
- file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
- file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
- endforeach()
-
foreach(fpath ${LIBCXX_ABILIB_FILES})
set(found FALSE)
foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
@@ -47,20 +39,31 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
set(found TRUE)
get_filename_component(dstdir ${fpath} PATH)
get_filename_component(ifile ${fpath} NAME)
- file(COPY "${incpath}/${fpath}"
- DESTINATION "${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}"
- )
- file(COPY "${incpath}/${fpath}"
- DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}"
- )
+ set(src ${incpath}/${fpath})
+
+ set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${fpath})
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying C++ ABI header ${fpath}...")
+ list(APPEND abilib_headers "${dst}")
+
+ if (NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
+ set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying C++ ABI header ${fpath}...")
+ list(APPEND abilib_headers "${dst}")
+ endif()
+
if (LIBCXX_INSTALL_HEADERS)
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
COMPONENT cxx-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
- list(APPEND abilib_headers "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}")
endif()
endforeach()
if (NOT found)
@@ -69,6 +72,8 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
endforeach()
include_directories("${LIBCXX_BINARY_INCLUDE_DIR}")
+ add_custom_target(cxx_abi_headers ALL DEPENDS ${abilib_headers})
+ set(LIBCXX_CXX_ABI_HEADER_TARGET "cxx_abi_headers")
endmacro()
@@ -93,10 +98,10 @@ if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
if (LIBCXX_CXX_ABI_INTREE)
# Link against just-built "cxxabi" target.
- if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
- set(CXXABI_LIBNAME cxxabi_static)
+ if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
+ set(CXXABI_LIBNAME cxxabi_static)
else()
- set(CXXABI_LIBNAME cxxabi_shared)
+ set(CXXABI_LIBNAME cxxabi_shared)
endif()
set(LIBCXX_LIBCPPABI_VERSION "2" PARENT_SCOPE)
else()