开发者

Cmake list-get command

Why doesn't the following command work?

SET(MY_LIST a b c d)
LIST(GET ${MY_LIST} 0 HEAD)
MESSAGE("HEAD = ${HEAD}")

I want it to assign a to HEAD but instead I'm getting NOTFOUND.

I have already tried surrounding ${MY_LIST} with double quotes and changing the inde开发者_C百科x to 1 instead of 0 (don't know why someone would do that but it didn't hurt to try).


The list commands require an unsubstituted variable as the second argument, i.e.:

set (MY_LIST a b c d)
list (GET MY_LIST 0 HEAD)
message ("HEAD = ${HEAD}") 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜