[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48952] trunk/blender/build_files/cmake/ macros.cmake: handy cmake list macros for inserting items into a list before/ after existing items

Campbell Barton ideasman42 at gmail.com
Mon Jul 16 10:26:42 CEST 2012


Revision: 48952
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48952
Author:   campbellbarton
Date:     2012-07-16 08:26:42 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
handy cmake list macros for inserting items into a list before/after existing items

Modified Paths:
--------------
    trunk/blender/build_files/cmake/macros.cmake

Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake	2012-07-16 07:23:16 UTC (rev 48951)
+++ trunk/blender/build_files/cmake/macros.cmake	2012-07-16 08:26:42 UTC (rev 48952)
@@ -23,6 +23,25 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+macro(list_insert_after
+	list_id item_check item_add
+	)
+	set(_index)
+	list(FIND ${list_id} "${item_check}" _index)
+	math(EXPR _index "${_index} + 1")
+	list(INSERT ${list_id} "${_index}" ${item_add})
+	unset(_index)
+endmacro()
+
+macro(list_insert_before
+	list_id item_check item_add
+	)
+	set(_index)
+	list(FIND ${list_id} "${item_check}" _index)
+	list(INSERT ${list_id} "${_index}" ${item_add})
+	unset(_index)
+endmacro()
+
 # foo_bar.spam --> foo_barMySuffix.spam
 macro(file_suffix
 	file_name_new file_name file_suffix




More information about the Bf-blender-cvs mailing list