2015-12-05 20:57:41 +03:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake)
|
|
|
|
|
|
|
|
# example from the documentation
|
|
|
|
# OPTIONAL is a keyword and therefore terminates the definition of
|
|
|
|
# the multi-value DEFINITION before even a single value has been added
|
|
|
|
|
|
|
|
set(options OPTIONAL FAST)
|
|
|
|
set(oneValueArgs DESTINATION RENAME)
|
|
|
|
set(multiValueArgs TARGETS CONFIGURATIONS)
|
|
|
|
cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
|
|
|
|
"${multiValueArgs}"
|
|
|
|
TARGETS foo DESTINATION OPTIONAL)
|
|
|
|
|
|
|
|
TEST(MY_INSTALL_DESTINATION UNDEFINED)
|
|
|
|
TEST(MY_INSTALL_OPTIONAL TRUE)
|
2016-02-12 15:21:12 +03:00
|
|
|
|
|
|
|
macro(foo)
|
|
|
|
set(_options )
|
|
|
|
set(_oneValueArgs FOO)
|
|
|
|
set(_multiValueArgs )
|
|
|
|
cmake_parse_arguments(_FOO2 "${_options}"
|
|
|
|
"${_oneValueArgs}"
|
|
|
|
"${_multiValueArgs}"
|
|
|
|
"${ARGN}")
|
|
|
|
cmake_parse_arguments(_FOO1 "${_options}"
|
|
|
|
"${_oneValueArgs}"
|
|
|
|
"${_multiValueArgs}"
|
|
|
|
${ARGN})
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
foo(FOO foo)
|
2016-02-21 21:38:16 +03:00
|
|
|
TEST(_FOO1_FOO foo)
|
|
|
|
TEST(_FOO2_FOO foo)
|
2016-02-12 15:21:12 +03:00
|
|
|
|
2016-02-21 21:38:16 +03:00
|
|
|
# Make sure a list is split
|
|
|
|
foo(FOO "foo;bar")
|
2016-02-12 15:21:12 +03:00
|
|
|
TEST(_FOO1_FOO foo)
|
2016-02-21 21:38:16 +03:00
|
|
|
TEST(_FOO1_UNPARSED_ARGUMENTS "bar")
|
2016-02-12 15:21:12 +03:00
|
|
|
TEST(_FOO2_FOO foo)
|
2016-02-21 21:38:16 +03:00
|
|
|
TEST(_FOO2_UNPARSED_ARGUMENTS "bar")
|
|
|
|
|
|
|
|
# Do not split if argn is quoted
|
|
|
|
foo(FOO "foo\\;bar")
|
|
|
|
TEST(_FOO1_FOO foo)
|
|
|
|
TEST(_FOO1_UNPARSED_ARGUMENTS "bar")
|
|
|
|
TEST(_FOO2_FOO foo;bar)
|
|
|
|
TEST(_FOO2_UNPARSED_ARGUMENTS "UNDEFINED")
|
|
|
|
|
|
|
|
# Do not split if argn is quoted
|
|
|
|
foo(FOO "foo\\\\;bar")
|
|
|
|
TEST(_FOO1_FOO foo)
|
|
|
|
TEST(_FOO1_UNPARSED_ARGUMENTS "bar")
|
|
|
|
TEST(_FOO2_FOO foo;bar)
|
|
|
|
TEST(_FOO2_UNPARSED_ARGUMENTS "UNDEFINED")
|