aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/CMakeLists.txt2
-rw-r--r--modules/MacroAppendIf.cmake22
-rw-r--r--modules/MacroLibrary.cmake2
3 files changed, 24 insertions, 2 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
index e8eba2e1..5de4aa7a 100644
--- a/modules/CMakeLists.txt
+++ b/modules/CMakeLists.txt
@@ -1,4 +1,4 @@
-# install the cmake files
+## install the cmake files
file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake")
diff --git a/modules/MacroAppendIf.cmake b/modules/MacroAppendIf.cmake
new file mode 100644
index 00000000..62949de2
--- /dev/null
+++ b/modules/MacroAppendIf.cmake
@@ -0,0 +1,22 @@
+# MACRO_APPEND_IF( VAR CONDITION VALUE1...VALUEN )
+# This convenience macro appends the values VALUE1 up to VALUEN to the list
+# given in VAR, but only if the variable CONDITION is TRUE:
+#
+# usage example:
+# IF(SOMELIB_FOUND)
+# SET(my_sources ${my_sources} somefile.c someotherfile.c)
+# ENDIF(SOMELIB_FOUND)
+#
+# becomes:
+# MACRO_APPEND_IF(my_sources SOMELIB_FOUND somefile.c someotherfile.c)
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro(macro_append_if _list _cond )
+ if(${_cond})
+ list(APPEND ${_list} ${ARGN})
+ endif(${_cond})
+endmacro(macro_append_if _list _cond )
diff --git a/modules/MacroLibrary.cmake b/modules/MacroLibrary.cmake
index 3b802126..5e482f92 100644
--- a/modules/MacroLibrary.cmake
+++ b/modules/MacroLibrary.cmake
@@ -1,5 +1,4 @@
# - include MacroLibrary offers a collection of macros which extend the built-in cmake commands
-# OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
@@ -12,6 +11,7 @@ INCLUDE(MacroAdditionalCleanFiles)
INCLUDE(MacroAddFileDependencies)
INCLUDE(MacroAddCompileFlags)
INCLUDE(MacroAddLinkFlags)
+INCLUDE(MacroAppendIf)
INCLUDE(MacroEnsureOutOfSourceBuild)
INCLUDE(MacroBoolTo01)
INCLUDE(MacroPushRequiredVars)