[CMake] Trouble with EXTERNALPROJECT_ADD, configure, and CFLAGS

2011-10-25 Thread Dan Kegel
I did

include(ExternalProject)
ExternalProject_Add(
CeltTarget
SOURCE_DIR ${CMAKE_SOURCE_DIR}/celt
INSTALL_DIR ${CMAKE_BINARY_DIR}/prefix
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/celt/configure -C
--prefix=${CMAKE_BINARY_DIR}/prefix --disable-shared --with-pic
CFLAGS=-g -O2 -fPIC
)

but configure failed when I typed 'make', saying

configure: error: in
`/home/dank/foo/build/CeltTarget-prefix/src/CeltTarget-build':
configure: error: C compiler cannot create executables
See `config.log' for more details.

config.log said

configure:3552: checking whether the C compiler works
configure:3574: gcc -g -O2 -fPIC   conftest.c  5
gcc: error: -g: No such file or directory

So, it seems to be a quoting problem.
(Removing the quotes doesn't work, of course, since then configure
complains that there's no such option -O2.)
Has anyone else run into this?
What's the right way to pass in cflags to the configure script in
ExternalProject_Add?

http://www.mail-archive.com/cmake@cmake.org/msg26433.html looks related.

$ cmake --version
cmake version 2.8.5
--

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


Re: [CMake] Trouble with EXTERNALPROJECT_ADD, configure, and CFLAGS

2011-10-25 Thread Dan Kegel
On Tue, Oct 25, 2011 at 10:05 AM, Dan Kegel d...@kegel.com wrote:
    CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/celt/configure -C 
 --prefix=${CMAKE_BINARY_DIR}/prefix --disable-shared --with-pic  CFLAGS=-g 
 -O2 -fPIC

Turns out the workaround is

CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/celt/configure -C
--prefix=${CMAKE_BINARY_DIR}/prefix --disable-shared --with-pic
CFLAGS=-g\ -O2\ -fPIC

That's just freaky.  I've never seen backslashes and double-quotes
behave differently like that.  I guess quotes are stickier in cmake
than in shell.
- Dan
--

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


Re: [CMake] Trouble with EXTERNALPROJECT_ADD, configure, and CFLAGS

2011-10-25 Thread David Cole
On Tue, Oct 25, 2011 at 1:09 PM, Dan Kegel d...@kegel.com wrote:

 On Tue, Oct 25, 2011 at 10:05 AM, Dan Kegel d...@kegel.com wrote:
 CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/celt/configure -C
 --prefix=${CMAKE_BINARY_DIR}/prefix --disable-shared --with-pic  CFLAGS=-g
 -O2 -fPIC

 Turns out the workaround is

CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/celt/configure -C
 --prefix=${CMAKE_BINARY_DIR}/prefix --disable-shared --with-pic
 CFLAGS=-g\ -O2\ -fPIC

 That's just freaky.  I've never seen backslashes and double-quotes
 behave differently like that.  I guess quotes are stickier in cmake
 than in shell.
 - Dan
 --

 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


If that works, then I'm pretty sure you could also do:

CFLAGS=-g -O2 -fPIC

The call to cmake's ExternalProject_Add function is the thing that parses at
the space separation boundary. Having double quotes around the whole thing
that's supposed to be one arg to configure should work.
--

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