[CMake] baffled by function string value set up

Rolf Eike Beer eike at sf-mail.de
Fri Jul 20 09:19:55 EDT 2012


Am 20.07.2012 13:35, schrieb hce:
> Hi,
>
> I am completely baffled by following results to get string values 
> from a
> function, please enlighten me what was wrong in following simplified
> function?
>
> function(GetParameterDebug oa ob oc od)
>     set(a "sa")
>     set(b "sb")
>     set(c "sc")
>     set(d "sd")
>     set(${oa} ${a} PARENT_SCOPE)
>     set(${ob} ${b} PARENT_SCOPE)
>     set(${oc} ${c} PARENT_SCOPE)
>     set(${od} ${d} PARENT_SCOPE)
>     message("## 1: a = .${a}. b = .${b}. c=.${c}. d=.${d}.")
>     message("## 2: oa = .${oa}. ob = .${ob}. oc = .${oc}. od = 
> .${od}.")
> endfunction(GetParameterDebug)
>
> GetParameterDebug(string_a, string_b, string_c, string_d)
> message("## debug string_a = .${string_a}., string_b = .${string_b}.,
> string_c = .${string_c}., string_d = .${string_d}.")

Just read your debug messages :)

> The result:
> ## 1: a = .sa. b = .sb. c=.sc. d=.sd.
> ## 2: oa = .string_a,. ob = .string_b,. oc = .string_c,. od = 
> .string_d.
                       ^                ^                ^
> ## debug string_a = .., string_b = .., string_c = .., string_d = .sd.

Eike


More information about the CMake mailing list