[runtimes] Remove add_target_flags* functions and use add_flags* instead
authorNikolas Klauser <nikolasklauser@berlin.de>
Mon, 20 Feb 2023 15:47:34 +0000 (16:47 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Tue, 21 Feb 2023 12:16:44 +0000 (13:16 +0100)
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144398

libcxx/CMakeLists.txt
libcxx/cmake/Modules/HandleLibcxxFlags.cmake
libcxxabi/CMakeLists.txt
libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake
libunwind/cmake/Modules/HandleLibunwindFlags.cmake

index 3e7a4ac..0c1b2fe 100644 (file)
@@ -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()
 
index d8aee2a..ec14341 100644 (file)
@@ -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)
index a92ada7..120d316 100644 (file)
@@ -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}")
index 976c6b5..16aed02 100644 (file)
@@ -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)
index 47b7083..5fa765a 100644 (file)
@@ -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)