FindCURL: Fix list index check after search
When searching for particular components and curl-config
reports one of
the components being searched for first in the list, find_package
fails.
This is due to the check that treats non-zero index in the list as success
and zero index as failure, while documentation on list(FIND)
states that
failure to find an element results in return value of -1 (not 0). I'm
hitting this when building cURL with support for HTTP and HTTPS protocols
only, and then trying to find_package(CURL COMPONENTS HTTP HTTPS)
.
I'm using if(NOT x EQUAL -1)
check form as it appears to be the most used
throughout the modules.
While fixing this issue I've looked through all the uses of list(FIND)
in
other modules but wasn't able to find improper use except here.
Introduced in !2677 (merged) (CMake 3.14).
Backport: release
Topic-rename: FindCURL-list-index-if