开发者

Cmake list-get command

开发者 https://www.devze.com 2023-03-29 06:03 出处:网络
Why doesn\'t the following command work? SET(MY_LIST a b c d) LIST(GET ${MY_LIST} 0 HEAD) MESSAGE(\"HEAD = ${HEAD}\")

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

精彩评论

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