diff options
author | Brad King <brad.king@kitware.com> | 2014-10-08 20:30:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-10-29 20:43:21 (GMT) |
commit | 80c881f7938969dab169f4fc4fbf8bc3d4355fc2 (patch) | |
tree | 77abe643bf8fcb388056480350b99b666f543965 /Utilities/cmcurl/CMake/Utilities.cmake | |
parent | ff67d2b57946a29e18d1947efe71f26ece9e1747 (diff) | |
parent | 3fe5d9bff98b4716e219516c30d71462495324f4 (diff) | |
download | CMake-80c881f7938969dab169f4fc4fbf8bc3d4355fc2.zip CMake-80c881f7938969dab169f4fc4fbf8bc3d4355fc2.tar.gz CMake-80c881f7938969dab169f4fc4fbf8bc3d4355fc2.tar.bz2 |
Merge branch 'curl-upstream' into update-curl
Resolve all conflicts in favor of the upstream side.
We can re-apply specific changes later.
Diffstat (limited to 'Utilities/cmcurl/CMake/Utilities.cmake')
-rw-r--r-- | Utilities/cmcurl/CMake/Utilities.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Utilities/cmcurl/CMake/Utilities.cmake b/Utilities/cmcurl/CMake/Utilities.cmake new file mode 100644 index 0000000..37cdfe3 --- /dev/null +++ b/Utilities/cmcurl/CMake/Utilities.cmake @@ -0,0 +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() + +# 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() + +# 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() |