Skip to content

Commit 67da89c

Browse files
authored
[libc++abi] Use target_compile_options to pass LIBCXXABI_ADDITIONAL_COMPILE_FLAGS (#96112)
We use target_compile_options to pass the libc++ variant of this flag, so we should be consistent for libc++abi. This is actually not only a matter of consistency: target_compile_options handles duplicate CMake options in a certain way (it removes duplicates but has an escape hatch using the "SHELL:" prefix), and it is important for both libc++ and libc++abi options to be handled in the same way.
1 parent 8d9db94 commit 67da89c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

libcxxabi/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
244244
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
245245
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
246246
endif()
247-
add_compile_flags("${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")
248247
add_library_flags("${LIBCXXABI_ADDITIONAL_LIBRARIES}")
249248

250249
# Configure compiler. Must happen after setting the target flags.

libcxxabi/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ set_target_properties(cxxabi_shared_objects
182182
if (CMAKE_POSITION_INDEPENDENT_CODE OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
183183
set_target_properties(cxxabi_shared_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) # must set manually because it's an object library
184184
endif()
185+
target_compile_options(cxxabi_shared_objects PUBLIC "${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")
185186

186187
if (LIBCXXABI_ENABLE_SHARED)
187188
add_library(cxxabi_shared SHARED)
@@ -261,6 +262,7 @@ set_target_properties(cxxabi_static_objects
261262
CXX_STANDARD_REQUIRED OFF # TODO: Make this REQUIRED once we don't need to accommodate the LLVM documentation builders using an ancient CMake
262263
COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}"
263264
)
265+
target_compile_options(cxxabi_static_objects PUBLIC "${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")
264266

265267
if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
266268
target_add_compile_flags_if_supported(cxxabi_static_objects PRIVATE -fvisibility=hidden)

0 commit comments

Comments
 (0)