diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-06-09 17:29:16 +0000 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-06-09 17:29:16 +0000 |
commit | 744dceaffe4f79293b6bdd9eefe64ca83c701876 (patch) | |
tree | 6613db6d276ab8502e3073ad9a5ce144302afbef /CMake/Utilities.cmake | |
parent | 8740d147c943f6d76194cb8c4e1e509c405722c6 (diff) | |
download | curl-744dceaffe4f79293b6bdd9eefe64ca83c701876.tar.gz |
ENH: lower case cmake functions and remove tabs and re-indent cmake code
Diffstat (limited to 'CMake/Utilities.cmake')
-rw-r--r-- | CMake/Utilities.cmake | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/CMake/Utilities.cmake b/CMake/Utilities.cmake index 4edf8b6d9..37cdfe3bf 100644 --- a/CMake/Utilities.cmake +++ b/CMake/Utilities.cmake @@ -1,31 +1,31 @@ # File containing various utilities # Converts a CMake list to a string containing elements separated by spaces -FUNCTION(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR) - SET(NEW_LIST_SPACE) - FOREACH(ITEM ${${_LIST_NAME}}) - SET(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}") - ENDFOREACH() - STRING(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE) - SET(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE) -ENDFUNCTION() +function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR) + set(NEW_LIST_SPACE) + foreach(ITEM ${${_LIST_NAME}}) + set(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}") + endforeach() + string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE) + set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE) +endfunction() # Appends a lis of item to a string which is a space-separated list, if they don't already exist. -FUNCTION(LIST_SPACES_APPEND_ONCE LIST_NAME) - STRING(REPLACE " " ";" _LIST ${${LIST_NAME}}) - LIST(APPEND _LIST ${ARGN}) - LIST(REMOVE_DUPLICATES _LIST) - TO_LIST_SPACES(_LIST NEW_LIST_SPACE) - SET(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE) -ENDFUNCTION() +function(LIST_SPACES_APPEND_ONCE LIST_NAME) + string(REPLACE " " ";" _LIST ${${LIST_NAME}}) + list(APPEND _LIST ${ARGN}) + list(REMOVE_DUPLICATES _LIST) + to_list_spaces(_LIST NEW_LIST_SPACE) + set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE) +endfunction() # Convinience function that does the same as LIST(FIND ...) but with a TRUE/FALSE return value. # Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND) -FUNCTION(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL) - LIST(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS) - IF(${FIND_POS} EQUAL -1) - SET(${RETVAL} FALSE PARENT_SCOPE) - ELSE() - SET(${RETVAL} TRUE PARENT_SCOPE) - ENDIF() -ENDFUNCTION() +function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL) + list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS) + if(${FIND_POS} EQUAL -1) + set(${RETVAL} FALSE PARENT_SCOPE) + else() + set(${RETVAL} TRUE PARENT_SCOPE) + endif() +endfunction() |