c8c45a2c4e
The re-implementation in commit v3.5.0-rc1~116^2~1 (CMakeParseArguments: replace by native cmake_parse_arguments command, 2015-12-05) introduced a regression when parsing the ARGN arguments with cmake_parse_arguments. The original implementation used foreach(currentArg ${ARGN}) to iterate over input arguments. This flattened ;-lists within the arguments whether they were quoted or not. Fix our new implementation to preserve this behavior and add a test case to cover it. Signed-off-by: Dimitar Yordanov <dimitar.yordanov@sap.com> Signed-off-by: Matthias Maennich <matthias.maennich@sap.com>
35 lines
1.1 KiB
CMake
35 lines
1.1 KiB
CMake
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)
|
|
|
|
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)
|
|
|
|
TEST(_FOO1_FOO foo)
|
|
TEST(_FOO2_FOO foo)
|