Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Commands can be added with function() or macro().
  • When a new command replaces an existing command, the old one can be accessed with a _ prefix.


function(my_command input output)
  # some comment
  set(${output} ... PARENT_SCOPE)
endfunction()
 
my_command(foo bar)



  • Variables are scoped to the function unless set with the PARENT_SCOPE
  • Available variables: input, output, ARGC, ARGN, ARG0, ARG1, ...
  • Example: ${output} expands to bar.



macro(my_command input output)
  # some comment
endmacro()
my_command(foo bar)


  • No extra scope with macros.
  • Text replacements: ${input}, ${output}, ${ARGC}, ${ARGV}, ${ARGN}, ${ARG0}, ...
  • Example: ${output} is replace by bar.

...