summaryrefslogtreecommitdiffstats
path: root/libcxx/cmake/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/cmake/Modules')
-rw-r--r--libcxx/cmake/Modules/HandleLibcxxFlags.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/libcxx/cmake/Modules/HandleLibcxxFlags.cmake b/libcxx/cmake/Modules/HandleLibcxxFlags.cmake
index 24fe0c5d5fb..fb60318a330 100644
--- a/libcxx/cmake/Modules/HandleLibcxxFlags.cmake
+++ b/libcxx/cmake/Modules/HandleLibcxxFlags.cmake
@@ -45,6 +45,29 @@ macro(check_flag_supported flag)
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
endmacro()
+macro(append_flags DEST)
+ foreach(value ${ARGN})
+ list(APPEND ${DEST} ${value})
+ list(APPEND ${DEST} ${value})
+ endforeach()
+endmacro()
+
+# If the specified 'condition' is true then append the specified list of flags to DEST
+macro(append_flags_if condition DEST)
+ if (${condition})
+ list(APPEND ${DEST} ${ARGN})
+ endif()
+endmacro()
+
+# Add each flag in the list specified by DEST if that flag is supported by the current compiler.
+macro(append_flags_if_supported DEST)
+ foreach(flag ${ARGN})
+ mangle_name("${flag}" flagname)
+ check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
+ append_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${DEST} ${flag})
+ endforeach()
+endmacro()
+
# Add a macro definition if condition is true.
macro(define_if condition def)
if (${condition})
OpenPOWER on IntegriCloud