@@ -83,6 +83,10 @@ endfunction()
8383
8484# Link against a system-provided libstdc++
8585if ("${LIBCXX_CXX_ABI} " STREQUAL "libstdc++" )
86+ if (NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
87+ message (FATAL_ERROR "LIBCXX_CXX_ABI_INCLUDE_PATHS must be set when selecting libstdc++ as an ABI library" )
88+ endif ()
89+
8690 add_library (libcxx-abi-headers INTERFACE )
8791 import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS} "
8892 "cxxabi.h;bits/c++config.h;bits/os_defines.h;bits/cpu_defines.h;bits/cxxabi_tweaks.h;bits/cxxabi_forced.h" )
@@ -96,6 +100,10 @@ if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++")
96100
97101# Link against a system-provided libsupc++
98102elseif ("${LIBCXX_CXX_ABI} " STREQUAL "libsupc++" )
103+ if (NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
104+ message (FATAL_ERROR "LIBCXX_CXX_ABI_INCLUDE_PATHS must be set when selecting libsupc++ as an ABI library" )
105+ endif ()
106+
99107 add_library (libcxx-abi-headers INTERFACE )
100108 import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS} "
101109 "cxxabi.h;bits/c++config.h;bits/os_defines.h;bits/cpu_defines.h;bits/cxxabi_tweaks.h;bits/cxxabi_forced.h" )
@@ -114,7 +122,18 @@ elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
114122 target_compile_definitions (libcxx-abi-headers INTERFACE "-DLIBCXX_BUILDING_LIBCXXABI" )
115123
116124 if (TARGET cxxabi_shared)
117- add_library (libcxx-abi-shared ALIAS cxxabi_shared)
125+ add_library (libcxx-abi-shared INTERFACE )
126+ target_link_libraries (libcxx-abi-shared INTERFACE cxxabi_shared)
127+
128+ # When using the in-tree libc++abi as an ABI library, libc++ re-exports the
129+ # libc++abi symbols (on platforms where it can) because libc++abi is only an
130+ # implementation detail of libc++.
131+ target_link_libraries (libcxx-abi-shared INTERFACE cxxabi-reexports)
132+
133+ # Populate the OUTPUT_NAME property of libcxx-abi-shared because that is used when
134+ # generating a linker script.
135+ get_target_property (_output_name cxxabi_shared OUTPUT_NAME )
136+ set_target_properties (libcxx-abi-shared PROPERTIES "OUTPUT_NAME" "${_output_name} " )
118137 endif ()
119138
120139 if (TARGET cxxabi_static)
@@ -131,6 +150,10 @@ elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
131150
132151# Link against a system-provided libc++abi
133152elseif ("${LIBCXX_CXX_ABI} " STREQUAL "system-libcxxabi" )
153+ if (NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
154+ message (FATAL_ERROR "LIBCXX_CXX_ABI_INCLUDE_PATHS must be set when selecting system-libcxxabi as an ABI library" )
155+ endif ()
156+
134157 add_library (libcxx-abi-headers INTERFACE )
135158 import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS} " "cxxabi.h;__cxxabi_config.h" )
136159 target_compile_definitions (libcxx-abi-headers INTERFACE "-DLIBCXX_BUILDING_LIBCXXABI" )
0 commit comments