CMake lists are essentially just semicolon-separated strings, but if you pass such a variable to a command, it does get expanded into multiple arguments - for example,
set(FLAGS f1 f2 f3)
# now FLAGS == 'f1;f2;f3'
add_custom_command(
...
COMMAND my_cmd ${FLAGS}
...
)
will correctly call my_cmd f1 f2 f3
.
Now if I do this with
set_target_properties(
myTarget PROPERTIES
LINK_FLAGS "${LD_FLAGS}"
)
the expansion does not occur, and I end up with a single LD_FLAG that contains semicolons -- useless, instead of expanding it into a space-separated string.
Is there any way to make it so that when I pass a list to the LINK_FLAGS property (or any property that is), it gets expanded into multiple arguments rather than just one?
Thanks,
Dan
question from:
https://stackoverflow.com/questions/11594905/how-do-i-correctly-pass-cmake-list-semicolon-sep-of-flags-to-set-target-proper 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…