diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-16 12:26:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-16 12:26:42 +0400 |
commit | 5b04685f49d13f58b4b6159d6bd6d6f970bc56bb (patch) | |
tree | 08d564a91a6fe0f50af381c46ba3073972a4da70 /build_files | |
parent | 60cfbaeb1eb4067a2b545a2e480d8eecb94ec417 (diff) |
handy cmake list macros for inserting items into a list before/after existing items
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/macros.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 3608f41e369..bceeb5acc86 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -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 |