summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-03-13 09:31:36 +0000
committerAlexey Samsonov <samsonov@google.com>2014-03-13 09:31:36 +0000
commit471b11cc0b977e4943395c718ef81ce767706298 (patch)
treed7ba094d45247ee62b5e04d55ee6337bd2ffd1d8 /cmake
parentaf905790774f263ee484991854037720c1fac373 (diff)
[CMake] Make append_if semantics similar to those used in LLVM
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@203773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/CompilerRTUtils.cmake13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
index 6c05a15d9..b8eef90bb 100644
--- a/cmake/Modules/CompilerRTUtils.cmake
+++ b/cmake/Modules/CompilerRTUtils.cmake
@@ -37,15 +37,18 @@ macro(pythonize_bool var)
endif()
endmacro()
-macro(append_if list condition var)
- if (${condition})
- list(APPEND ${list} ${var})
+# Appends value to all lists in ARGN, if the condition is true.
+macro(append_if condition value)
+ if(${condition})
+ foreach(list ${ARGN})
+ list(APPEND ${list} ${value})
+ endforeach()
endif()
endmacro()
macro(append_no_rtti_flag list)
- append_if(${list} COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti)
- append_if(${list} COMPILER_RT_HAS_GR_FLAG /GR-)
+ append_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti ${list})
+ append_if(COMPILER_RT_HAS_GR_FLAG /GR- ${list})
endmacro()
macro(add_definitions_if condition)