Quantcast

baffled by function string value set up

classic Classic list List threaded Threaded
3 messages Options
hce
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

baffled by function string value set up

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}.")

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.


The about print out ##1 was good, the ##2 and ## debug were completely wrong.

Thank you and appreciate explanation.





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: baffled by function string value set up

Rolf Eike Beer
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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: baffled by function string value set up

David Cole
On Fri, Jul 20, 2012 at 9:19 AM, Rolf Eike Beer <[hidden email]> wrote:

> 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
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


Call GetParameterDebug like this:

  GetParameterDebug(string_a string_b string_c string_d)

i.e. -- don't use commas, args are space separated in CMake
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Loading...