issue with cmake

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

issue with cmake

johnmci
 
I noticed if you 
mkdir bld
cd bld
../platforms/unix/cmake/configure --CFLAGS="-foo" 

-- Setting CFLAGS=-foo
-- Using CFLAGS -g -fomit-frame-pointer -O2

make -n 
confirms that the CFLAGS used for gcc is the "-g -fomit-frame-pointer -O2" not the -foo you asked for. 

Now if you toss chicken entrails about you might get 
-- Setting CFLAGS=-fum 
-- Setting CFLAGS=-foo
---Setting -g -fomit-frame-pointer -O2
--Using CFLAGS -fum 

Or you repeat the 
../platforms/unix/cmake/configure --CFLAGS="-foo" 
a couple of times, then it takes well maybe... 

Or various hand waving of CFLAGS=
rm CMakeCache.txt

maybe some can explain the magic, or fix the script? 

--
===========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================


Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] issue with cmake

David T. Lewis
 
On Thu, Jan 21, 2010 at 07:52:12PM -0800, John McIntosh wrote:

>  
> I noticed if you
> mkdir bld
> cd bld
> ../platforms/unix/cmake/configure --CFLAGS="-foo"
>
> -- Setting CFLAGS=-foo
> -- Using CFLAGS -g -fomit-frame-pointer -O2
>
> make -n
> confirms that the CFLAGS used for gcc is the "-g -fomit-frame-pointer -O2"
> not the -foo you asked for.
>
> Now if you toss chicken entrails about you might get
> -- Setting CFLAGS=-fum
> -- Setting CFLAGS=-foo
> ---Setting -g -fomit-frame-pointer -O2
> --Using CFLAGS -fum
>
> Or you repeat the
> ../platforms/unix/cmake/configure --CFLAGS="-foo"
> a couple of times, then it takes well maybe...
>
> Or various hand waving of CFLAGS=
> rm CMakeCache.txt
>
> maybe some can explain the magic, or fix the script?

I definitely can't explain the magic, but I've found that if I
delete the entire contents of my build directory, then start
fresh with configure, then the chicken entrails usually become
better aligned.

FWIW, I'm also in the habit of using this directory structure:

./platforms
./src32
./src64
./build32
./build64

Then from an empty build64 directory, I run configure with a
command line such as:

../platforms/unix/cmake/configure --src=../src64 --without-gl --CFLAGS=' -g -m64'

Dave

Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] issue with cmake

Levente Uzonyi-2
In reply to this post by johnmci
 
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.


Levente
Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] issue with cmake

Levente Uzonyi-2
 
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
>
Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] issue with cmake

David T. Lewis
 
On Fri, Jan 22, 2010 at 01:49:01PM +0100, Levente Uzonyi wrote:

>
> 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,

Wow, nice debugging! Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] issue with cmake

Levente Uzonyi-2
 
Idézet ("David T. Lewis" <[hidden email]>):

>
> On Fri, Jan 22, 2010 at 01:49:01PM +0100, Levente Uzonyi wrote:
>>
>> 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,
>
> Wow, nice debugging! Thanks.
>
>
Thanks, I made a quick-and-dirty fix which I attached.


Levente

CMakeLists.txt (3K) Download Attachment