[CMake] ctest-2.6.4 and ctest 2.8.0 - LIST(FIND ...) always returns -1

Clemens Arth clemens.arth at gmx.at
Fri Dec 11 06:18:16 EST 2009


Hi again,

ok, I did not realize that the LIST functions take the variable name instead of the 
list content as argument (that is not documented anywhere). However, after trying all 
possible variants I got it to work now using

SET(MYLIST foo bar)
SET(ITEM2FIND foo)
LIST(FIND MYLIST ${ITEM2FIND} INDEX)

Probably someone should include a small example in the documentation for
clearance.

Regards
Clemens

Am 11.12.2009 12:10, schrieb Clemens Arth:
> Sorry for the typos,
>
> I tested it with 2.6.4 and 2.8.0;
> The return value is (separated by ; not ,)
>
> "Index of "foo" in list "foo;bar" is -1"
>
> Regards
>
>
>
> Am 11.12.2009 12:06, schrieb Clemens Arth:
>   
>> Hi, 
>>
>> probably I did something wrong, but with both ctest 2.6.4 and 2.8.0 the following is not working:
>>
>> SET(MYLIST foo bar)
>>
>> SET(ITEM2FIND foo)
>>
>> LIST(FIND "${MYLIST}" "${ITEM2FIND}" INDEX)
>>
>> MESSAGE(FATAL_ERROR "Index of \"${ITEM2FIND}\" in list \"${MYLIST}\" is ${INDEX}")
>>
>> always returns 
>>
>> "Index of "foo" in list "foo,bar" is -1"
>>
>> Can someone reproduce this error (or tell me what I'm doing wrong?)
>>
>> Regards...
>>
>> Clemens
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>   
>>     
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
>   



More information about the CMake mailing list