[CMake] Bug with wxWidgets_CXX_FLAGS

Andrew Sayman andrew.sayman at gmail.com
Thu May 21 18:04:48 EDT 2009


I came across a problem when porting to another Unix platform today
with wxWidgets_CXX_FLAGS. There's a bug in how it parses and removes
definitions from wx-config's cxxflags output. I suspect this class of
bug applies to all pkg-config like and other gcc compile flags parsing
routines.

In essence, the following two regex replaces need to be included when
trying to remove definitions:
STRING(REGEX REPLACE ";-D[^;]+$" "" wxWidgets_CXX_FLAGS
"${wxWidgets_CXX_FLAGS}")
STRING(REGEX REPLACE "^-D[^;]+$" "" wxWidgets_CXX_FLAGS
"${wxWidgets_CXX_FLAGS}")

The first properly removes definitions that exist at the end of the
flags. The second properly removes a definition if it is the only
component of the C[XX]FLAGS.

I suspect a similar problem exists for includes when includes are the
only component of the flags.

Andrew Sayman


More information about the CMake mailing list