[CMake] Debug build compiles and links, but Release build fails to link?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Mar 14 21:34:22 EST 2007


On 2007-03-14 19:50-0400 Jean-Sébastien Guay wrote:

> I personally can't spot a major difference between the two (aside from -g 
> replaced by -O3 and NDEBUG being defined, which shouldn't prevent it from 
> linking).

I ran into a similar problem recently.  I am no expert on NDEBUG, but from a
superficial google search it appears it generally removes the debugging part
of your code.  In my case I had an assert statement with executed a needed
function. NDEBUG turned that into a noop, the function call did not occur,
and all hell broke loose. To fix the problem, the code now always calls the
needed function, saves the return code, and only uses assert on a test of
that saved return code.

My conclusion from this experience is you have to be really careful about
how the debugging part of your code is defined before NDEBUG works properly.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list