[CMake] cmake_parse_arguments and empty strings

Alexander Neundorf a.neundorf-work at gmx.net
Mon Mar 11 17:23:49 EDT 2013


On Monday 11 March 2013, Luc J. Bourhis wrote:
> Consider the following snippet
> 
> cmake_minimum_required(VERSION 2.8)
> 
> include (CMakeParseArguments)
> 
> function(foo)
>     set(options)
>     set(one_valued)
>     set(multi_valued)
>     cmake_parse_arguments("_" "${options}" "${one_valued}"
> "${multi_valued}" ${ARGN})
>     message(">>${__UNPARSED_ARGUMENTS}<<")
> endfunction()
> 
> foo(ARG "")
> 
> This will print
> 
> >>ARG<<
> 
> Thus, if I was to pass ${__UNPARSED_ARGUMENTS} to another function "bar"
> expecting "ARG value", that function "bar" would not work correctly because
> it would not be called as bar(... ARG "" ...).
> 
> I would naively consider that a bug.

I'm not completely sure such an empty string can actually be preserved in 
cmake script.
Please create a ticket for it at http://public.kitware.com/Bug/

Thanks
Alex


More information about the CMake mailing list