OrangesFunctionArgumentHelpers

Macros for validating function arguments, to be used in combination with cmake_parse_arguments().

Require function arguments

oranges_require_function_arguments
oranges_require_function_arguments (<prefix> <args...>)

Raises a fatal error if any of the <args> were not specified in the call to the current function.

Example usage:

function(myFunction)

    cmake_parse_arguments (MY_ARGS "" "TARGET" "OPTIONS" ${ARGN})

    oranges_require_function_arguments (MY_ARGS TARGET OPTIONS)

endfunction()

With the above usage, a fatal error will be raised if myFunction is called without specifying TARGET and at least one value for OPTIONS.

Check for unparsed arguments

oranges_check_for_unparsed_args
oranges_check_for_unparsed_args (<prefix>)

Raises a fatal error if any unparsed arguments were passed to the current function. The <prefix> should be the prefix given to cmake_parse_arguments.

Check that a target argument exists

oranges_assert_target_argument_is_target
oranges_assert_target_argument_is_target (<prefix>)

Checks that a keyword argument named <prefix>_TARGET was specified, and that its value is a target that exists.