[CMake] Support for -D prefixed compiler flags
Andreas Pakulat
apaku at gmx.de
Wed Feb 20 02:57:44 EST 2013
Hi,
On Wed, Feb 20, 2013 at 6:39 AM, Patrick McMunn <doctorwhoguy at gmail.com> 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
More information about the CMake
mailing list