[CMake] VS Project Question

Surya Kiran Gullapalli suryakiran.gullapalli at gmail.com
Mon Mar 31 23:24:49 EDT 2008


>
>  I want to do similar change for ADD_EXECUTABLE as well.
> >
> > For Debug builds I want to have a console popping up to show the debug
> > messages, and for release builds I do not want the console.
> >
> > How can i change the ADD_EXECUTABLE  call accordingly to supply extra
> > option WIN32 based on the build type.?
>
>
> Same limiting issue here.  You can build the executable twice for all
> configurations (one with WIN32, one without) or you can resort to a single
> build configuration per Visual Studio solution file.
>
> For you to get the kind of behavior you want, CMake would have to be
> modified to run multiple times for each build type in
> CMAKE_CONFIGURATION_TYPES and then modify the project files accordingly for
> each configuration type, depending on the CMake commands the user issued.
> This would be a neat feature request to add but could prove difficult to
> implement.
>

Use

SET_TARGET_PROPERTIES ( ${TARGET} PROPERTIES
LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS"
LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE"
LINK_FLAGS "/ENTRY:mainCRTStartup"
)

In that case, debug executable will be built with a console and release one
with out console.

Surya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080401/f0e6fef7/attachment-0001.htm>


More information about the CMake mailing list