[Cmake] Why debug info for release mode application?

Reinhold Füreder R . Fureder at exeter . ac . uk
Fri, 31 Oct 2003 09:01:43 +0100


Hi,

(Windows2000/XP, CMake 1.8.1, MSVC++ 6 SP 5, wxWindows 2.4.?, ...)
When using CMake to build an wxWindows-GUI application (statically)
linking with VTK, Crypto++ and of course wxWindows the final .dsp has
the debug info switched on, even for the release mode application. Thus,
when compiling we get a lot of the following warnings:

Cryptlib.lib (...obj): warning LNK4099: PDB .. Was not found ... Linking
object as if no debug info.

As we do not want the debug info in the release mode this switch should
not be on (it is the /debug option in LINK32 section in .dsp file). (And
there is no adequate .pdb file in the otherwise correct location pointed
out by the linking warning.)

The corresponding CMakeLists.txt contains:
---
ADD_EXECUTABLE (OurApp WIN32 ${SRC} ${HDR}) 
 
TARGET_LINK_LIBRARIES (OurApp
    debug ${CryptoPP_DEBUG_LIBRARIES} 
    optimized ${CryptoPP_LIBRARIES}   
 
    ${WXWINDOWS_LIBRARY}   
) 
---

The CMake flag WIN32 for the ADD_EXECUTABLE is necessary because it is
not a console application. If we omit this flag the debug info is
switched off (but of course, then the compiling fails...).
If we remove the debug info switch manually in MSVC++ project settings
we can compile and link the application without any problems.

Reinhold


------------------------
Reinhold Füreder
School of Engineering and Computer Science
University of Exeter, UK