Skip to content

Commit

Permalink
[runtimes] Remove add_target_flags* functions and use add_flags* instead
Browse files Browse the repository at this point in the history
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144398
  • Loading branch information
philnik777 committed Feb 21, 2023
1 parent 0af67d1 commit d0e95fe
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 96 deletions.
2 changes: 1 addition & 1 deletion libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ include(HandleLibcxxFlags)
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'

if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
add_target_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
endif()

Expand Down
31 changes: 0 additions & 31 deletions libcxx/cmake/Modules/HandleLibcxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,6 @@ include(HandleFlags)

unset(add_flag_if_supported)

# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
macro(add_target_flags)
foreach(value ${ARGN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
list(APPEND LIBCXX_LINK_FLAGS ${value})
endforeach()
endmacro()

# If the specified 'condition' is true then add a list of flags to
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
# and 'LIBCXX_LINK_FLAGS'.
macro(add_target_flags_if condition)
if (${condition})
add_target_flags(${ARGN})
endif()
endmacro()

# Add all the flags supported by the compiler to all of
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
# and 'LIBCXX_LINK_FLAGS'.
macro(add_target_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()

# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
# 'LIBCXX_LINK_FLAGS'.
macro(add_flags)
Expand Down
4 changes: 2 additions & 2 deletions libcxxabi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ include(HandleLibcxxabiFlags)

# Configure target flags
if(ZOS)
add_target_flags_if_supported("-fzos-le-char-mode=ebcdic")
add_flags_if_supported("-fzos-le-char-mode=ebcdic")
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
add_target_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
endif()
add_compile_flags("${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")
Expand Down
31 changes: 0 additions & 31 deletions libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,6 @@ include(HandleFlags)

unset(add_flag_if_supported)

# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
# 'LIBCXXABI_COMPILE_FLAGS' and 'LIBCXXABI_LINK_FLAGS'.
macro(add_target_flags)
foreach(value ${ARGN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
list(APPEND LIBCXXABI_COMPILE_FLAGS ${value})
list(APPEND LIBCXXABI_LINK_FLAGS ${value})
endforeach()
endmacro()

# If the specified 'condition' is true then add a list of flags to
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXXABI_COMPILE_FLAGS'
# and 'LIBCXXABI_LINK_FLAGS'.
macro(add_target_flags_if condition)
if (${condition})
add_target_flags(${ARGN})
endif()
endmacro()

# Add all the flags supported by the compiler to all of
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXXABI_COMPILE_FLAGS'
# and 'LIBCXXABI_LINK_FLAGS'.
macro(add_target_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()

# Add a specified list of flags to both 'LIBCXXABI_COMPILE_FLAGS' and
# 'LIBCXXABI_LINK_FLAGS'.
macro(add_flags)
Expand Down
31 changes: 0 additions & 31 deletions libunwind/cmake/Modules/HandleLibunwindFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@ include(HandleFlags)

unset(add_flag_if_supported)

# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
# 'LIBUNWIND_COMPILE_FLAGS' and 'LIBUNWIND_LINK_FLAGS'.
macro(add_target_flags)
foreach(value ${ARGN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
list(APPEND LIBUNWIND_COMPILE_FLAGS ${value})
list(APPEND LIBUNWIND_LINK_FLAGS ${value})
endforeach()
endmacro()

# If the specified 'condition' is true then add a list of flags to
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBUNWIND_COMPILE_FLAGS'
# and 'LIBUNWIND_LINK_FLAGS'.
macro(add_target_flags_if condition)
if (${condition})
add_target_flags(${ARGN})
endif()
endmacro()

# Add all the flags supported by the compiler to all of
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBUNWIND_COMPILE_FLAGS'
# and 'LIBUNWIND_LINK_FLAGS'.
macro(add_target_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()

# Add a specified list of flags to both 'LIBUNWIND_COMPILE_FLAGS' and
# 'LIBUNWIND_LINK_FLAGS'.
macro(add_flags)
Expand Down

0 comments on commit d0e95fe

Please sign in to comment.