[Vm-dev] issue with cmake

Levente Uzonyi leves at elte.hu
Fri Jan 22 12:49:01 UTC 2010


On Fri, 22 Jan 2010, Levente Uzonyi wrote:

>
> On Thu, 21 Jan 2010, John McIntosh wrote:
>
>> maybe some can explain the magic, or fix the script?
>
> There's a bug in platforms/unix/CMakeLists.txt. At line 29, there's
>    STRING (REGEX REPLACE "OPT--(.*)" "\\1" var ${opt})
> This line splits the arguments in an unexpected way.
> If you replace the next line
>   MESSAGE (STATUS "Setting ${var}=${${opt}}")
> with
>   MESSAGE (STATUS "Setting ${var} to ${${opt}}")
> the error will be obvious.
> CFLAGS will be unset, so it will fall back to the default.

It turned out to be a CMake bug/feature.
If opt contains an = character, say opt is "foo=bar" then ${opt} will be 
"foo" and ${$opt} will be "bar". If opt contains more than one = 
character, the last will count (dumb, dumb, dumb...), so if opt is 
"CFLAGS=-O3 -march=native" then $opt will be "CFLAGS=-O3 -march" and 
${$opt} will be "native".


Levente

>
>
> Levente
>


More information about the Vm-dev mailing list