Skip to content

Commit d0e95fe

Browse files
committed
[runtimes] Remove add_target_flags* functions and use add_flags* instead
Reviewed By: phosek, #libunwind, #libc, #libc_abi Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D144398
1 parent 0af67d1 commit d0e95fe

File tree

5 files changed

+3
-96
lines changed

5 files changed

+3
-96
lines changed

libcxx/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ include(HandleLibcxxFlags)
465465
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
466466

467467
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
468-
add_target_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
468+
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
469469
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
470470
endif()
471471

libcxx/cmake/Modules/HandleLibcxxFlags.cmake

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,6 @@ include(HandleFlags)
99

1010
unset(add_flag_if_supported)
1111

12-
# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
13-
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
14-
macro(add_target_flags)
15-
foreach(value ${ARGN})
16-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
17-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
18-
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
19-
list(APPEND LIBCXX_LINK_FLAGS ${value})
20-
endforeach()
21-
endmacro()
22-
23-
# If the specified 'condition' is true then add a list of flags to
24-
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
25-
# and 'LIBCXX_LINK_FLAGS'.
26-
macro(add_target_flags_if condition)
27-
if (${condition})
28-
add_target_flags(${ARGN})
29-
endif()
30-
endmacro()
31-
32-
# Add all the flags supported by the compiler to all of
33-
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
34-
# and 'LIBCXX_LINK_FLAGS'.
35-
macro(add_target_flags_if_supported)
36-
foreach(flag ${ARGN})
37-
mangle_name("${flag}" flagname)
38-
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
39-
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
40-
endforeach()
41-
endmacro()
42-
4312
# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
4413
# 'LIBCXX_LINK_FLAGS'.
4514
macro(add_flags)

libcxxabi/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ include(HandleLibcxxabiFlags)
246246

247247
# Configure target flags
248248
if(ZOS)
249-
add_target_flags_if_supported("-fzos-le-char-mode=ebcdic")
249+
add_flags_if_supported("-fzos-le-char-mode=ebcdic")
250250
endif()
251251

252252
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
253-
add_target_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
253+
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
254254
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
255255
endif()
256256
add_compile_flags("${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")

libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,6 @@ include(HandleFlags)
99

1010
unset(add_flag_if_supported)
1111

12-
# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
13-
# 'LIBCXXABI_COMPILE_FLAGS' and 'LIBCXXABI_LINK_FLAGS'.
14-
macro(add_target_flags)
15-
foreach(value ${ARGN})
16-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
17-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
18-
list(APPEND LIBCXXABI_COMPILE_FLAGS ${value})
19-
list(APPEND LIBCXXABI_LINK_FLAGS ${value})
20-
endforeach()
21-
endmacro()
22-
23-
# If the specified 'condition' is true then add a list of flags to
24-
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXXABI_COMPILE_FLAGS'
25-
# and 'LIBCXXABI_LINK_FLAGS'.
26-
macro(add_target_flags_if condition)
27-
if (${condition})
28-
add_target_flags(${ARGN})
29-
endif()
30-
endmacro()
31-
32-
# Add all the flags supported by the compiler to all of
33-
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXXABI_COMPILE_FLAGS'
34-
# and 'LIBCXXABI_LINK_FLAGS'.
35-
macro(add_target_flags_if_supported)
36-
foreach(flag ${ARGN})
37-
mangle_name("${flag}" flagname)
38-
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
39-
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
40-
endforeach()
41-
endmacro()
42-
4312
# Add a specified list of flags to both 'LIBCXXABI_COMPILE_FLAGS' and
4413
# 'LIBCXXABI_LINK_FLAGS'.
4514
macro(add_flags)

libunwind/cmake/Modules/HandleLibunwindFlags.cmake

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,6 @@ include(HandleFlags)
1010

1111
unset(add_flag_if_supported)
1212

13-
# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
14-
# 'LIBUNWIND_COMPILE_FLAGS' and 'LIBUNWIND_LINK_FLAGS'.
15-
macro(add_target_flags)
16-
foreach(value ${ARGN})
17-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
18-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
19-
list(APPEND LIBUNWIND_COMPILE_FLAGS ${value})
20-
list(APPEND LIBUNWIND_LINK_FLAGS ${value})
21-
endforeach()
22-
endmacro()
23-
24-
# If the specified 'condition' is true then add a list of flags to
25-
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBUNWIND_COMPILE_FLAGS'
26-
# and 'LIBUNWIND_LINK_FLAGS'.
27-
macro(add_target_flags_if condition)
28-
if (${condition})
29-
add_target_flags(${ARGN})
30-
endif()
31-
endmacro()
32-
33-
# Add all the flags supported by the compiler to all of
34-
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBUNWIND_COMPILE_FLAGS'
35-
# and 'LIBUNWIND_LINK_FLAGS'.
36-
macro(add_target_flags_if_supported)
37-
foreach(flag ${ARGN})
38-
mangle_name("${flag}" flagname)
39-
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
40-
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
41-
endforeach()
42-
endmacro()
43-
4413
# Add a specified list of flags to both 'LIBUNWIND_COMPILE_FLAGS' and
4514
# 'LIBUNWIND_LINK_FLAGS'.
4615
macro(add_flags)

0 commit comments

Comments
 (0)