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

Jean-Sébastien Guay jean-sebastien.guay at polymtl.ca
Thu Mar 15 08:47:48 EST 2007


Hello Alan,

>> 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.

I mentioned that my project just did not _link_ anymore. Your problem  
was that it compiled and linked, but then when you ran it it gave  
erroneous results because the code in asserts was not run. Those are  
two totally different problems.

I already take the habit of not putting any code that must run inside  
asserts, precisely for this reason. That's not the problem here.

My original question remains: Why would the same code, using the same  
CMakeLists.txt files, compile and link in Debug mode but not link in  
Release mode?

Again, I am not even at the stage of trying to run the program. The  
final link phase fails in Release.

Any help would be appreciated.

J-S
-- 
______________________________________________________
Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca
                         http://whitestar02.webhop.org/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the CMake mailing list