[CMake] baffled by function string value set up

David Cole david.cole at kitware.com
Fri Jul 20 09:36:02 EDT 2012


On Fri, Jul 20, 2012 at 9:19 AM, Rolf Eike Beer <eike at sf-mail.de> 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


More information about the CMake mailing list