cmake: don't run SORT on empty list

In case of an empty list, SORTing leads to the cmake error "list
sub-command SORT requires list to be present."

Closes https://github.com/curl/curl/pull/3736
This commit is contained in:
Simon Warta 2019-04-06 15:05:50 +02:00 committed by Marcel Raad
parent 55734f3a27
commit 1a3aa5c321
No known key found for this signature in database
GPG Key ID: FE4D8BC5EE1701DD
1 changed files with 3 additions and 1 deletions

View File

@ -1239,7 +1239,9 @@ _add_if("SCP" USE_LIBSSH2)
_add_if("SFTP" USE_LIBSSH2)
_add_if("RTSP" NOT CURL_DISABLE_RTSP)
_add_if("RTMP" USE_LIBRTMP)
list(SORT _items)
if(_items)
list(SORT _items)
endif()
string(REPLACE ";" " " SUPPORT_PROTOCOLS "${_items}")
message(STATUS "Enabled protocols: ${SUPPORT_PROTOCOLS}")