[CMake] try_run removes semicolons from output?

Michael Wild themiwi at gmail.com
Thu Feb 3 11:43:55 EST 2011


On 02/03/2011 05:32 PM, Dominik Szczerba wrote:
> Still not sure bug or not, but trying things out blind I found a
> workaround: enclose contents of RUN_OUTPUT_VARIABLE in quotes.
> 
> Dominik
> 
> On Thu, Feb 3, 2011 at 5:24 PM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
>> I am using try_run to generate an include file by a single program
>> containing lines like:
>>
>> printf ("static double foo = %f;\n", foo);
>>
>> To my great surprise, RUN_OUTPUT_VARIABLE contains all the lines as
>> expected but without trailing ";" symbols. There is nothing about this
>> unexpected behavior in the description of this command in cmake. Did I
>> miss something in the documentation or I should rather file a bug?
>>
>> Regards,
>> Dominik


That's because ; are used as list item separator. So if you don't quote
it, CMake will see

message(STATUS ${RUN_OUTPUT_VARIABLE})

as

message(STATUS item1 item2 item3 item4)


HTH

Michael


More information about the CMake mailing list