• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2if (DEFINED TARGET_TRIPLE)
3    if (TARGET_TRIPLE MATCHES "darwin")
4        # Ignore the major, minor, and patchlevel versions of darwin targets.
5        string(REGEX REPLACE "darwin[0-9]+\\.[0-9]+\\.[0-9]+" "darwin"
6               GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
7    elseif(TARGET_TRIPLE MATCHES "freebsd")
8        # Ignore the major and minor versions of freebsd targets.
9        string(REGEX REPLACE "freebsd[0-9]+\\.[0-9]+" "freebsd"
10               GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
11    else()
12        set(GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
13    endif()
14endif()
15
16# Detect if we are building in the same configuration used to generate
17# the abilist files.
18set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.v${LIBCXX_ABI_VERSION}.abilist")
19set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py")
20if (EXISTS "${ABILIST_FILE}"
21    AND TARGET cxx_shared
22    AND ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi" OR
23         (APPLE AND "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "default"))
24    AND NOT LIBCXX_ABI_UNSTABLE)
25    add_custom_target(check-cxx-abilist
26            ${SYMDIFF_EXE} --only-stdlib-symbols --strict ${ABILIST_FILE}
27            $<TARGET_SONAME_FILE:cxx_shared>
28            DEPENDS cxx_shared
29            COMMENT "Testing ABI compatibility...")
30else()
31    message(STATUS "there is no pre-generated ABI list for the requested libc++ configuration. "
32            "check-cxx-abilist target is not supported")
33endif()
34