In scripts, CMake can be interpreted as lists. The rule is simple: to form a list, divide the line by a semicolon. For example, the string value one;two;three can be thought of as a list of three elements: one , two and three .
To invoke a command, you write the name of the command and a few words between parentheses. However, these words do not correspond to the arguments that the team receives individually. Each word becomes zero or more arguments, and all arguments are combined together. If the word is not quoted, it is considered as a list and expanded to a few arguments. The keyword always becomes the only argument.
For example, suppose X bound to one;two;three , Y bound to an empty string, and Z bound to foo . The next command invocation has three words, but the command receives four arguments:
some_command(${X} ${Y} ${Z})
If we quoted the words, the team would receive three arguments:
some_command("${X}" "${Y}" "${Z}")
To return to the original question: the message command can take a different number of arguments. It takes all its arguments, combines them into one line, and then prints that line. For some unknown reason, it does not accept null arguments.
The behavior of message with multiple arguments is not very useful, so you tend to use a single quoted argument with it:
set(SOURCES foo.c hoo.h) message(${SOURCES})
In addition, when set receives multiple arguments, it builds a string of arguments separated by semicolons. Then the variable is set to this line.
raek Nov 27 '12 at 11:43 2012-11-27 11:43
source share