Support for -D prefixed compiler flags

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Support for -D prefixed compiler flags

Patrick McMunn
I'm not 100% sure this is a cmake bug or if this is even the place to report it, but I ran into a bug as described here: http://www.gccxml.org/Bug/view.php?id=11069 It seems that cmake gives an error when checking the compiler flags needed for a library. The library has, depending on the particular system's configuration, possible one or two compiler flags prefixed with -D such as -D_REENTRANT or -DQT_SHARED. cmake thinks that these are cmake parameters rather than compiler flags, and this causes an error. The current workaround appears to be to add =1 so that the compiler flag becomes, for example, -D_RENTRANT=1. cmake is happy with this, and it looks like gcc accepts it without complaint, but it requires a specific workaround for each problematic compiler flag. Is this a cmake bug that should be fixed or perhaps something that needs to be changed with the compiz cmake setup?

--
Patrick McMunn

- Learn more about the Catholic Faith: http://www.catholic.com/
- Pray with the Church: http://www.universalis.com/


--

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

Re: Support for -D prefixed compiler flags

Andreas Pakulat-2
Hi,

On Wed, Feb 20, 2013 at 6:39 AM, Patrick McMunn <[hidden email]> wrote:

> I'm not 100% sure this is a cmake bug or if this is even the place to report
> it, but I ran into a bug as described here:
> http://www.gccxml.org/Bug/view.php?id=11069 It seems that cmake gives an
> error when checking the compiler flags needed for a library. The library
> has, depending on the particular system's configuration, possible one or two
> compiler flags prefixed with -D such as -D_REENTRANT or -DQT_SHARED. cmake
> thinks that these are cmake parameters rather than compiler flags, and this
> causes an error. The current workaround appears to be to add =1 so that the
> compiler flag becomes, for example, -D_RENTRANT=1. cmake is happy with this,
> and it looks like gcc accepts it without complaint, but it requires a
> specific workaround for each problematic compiler flag. Is this a cmake bug
> that should be fixed or perhaps something that needs to be changed with the
> compiz cmake setup?

As the comment on that report says, using CMAKE_REQUIRED_FLAGS for
defines is simply wrong. You should use CMAKE_REQUIRED_DEFINITIONS for
defines you want to pass to the compiler. If using
CMAKE_REQUIRED_DEFINTIONS with just a -D_REENTRANT still triggers the
problem, then you have indeed found a bug in cmake and should report
it along with a small example.

Andreas
--

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