[CMake] Win32 Executable.

Brandon Van Every bvanevery at gmail.com
Fri Feb 1 14:16:53 EST 2008


On Feb 1, 2008 8:14 AM, Surya Kiran Gullapalli
<suryakiran.gullapalli at gmail.com> wrote:
> Hi all,
> I'm building a win32 application, and for that I wanted to build the
> application as console application in debug mode and win32 application
> in release mode.
>
> ADD_EXECUTABLE takes care of /subsystem:windows or /subsystem:console
> flag, depends on whether or not you provide WIN32 flag to
> ADD_EXECUTABLE.
>
> I switch between debug and release builds quite often. It is very
> inconvenient to modify the add_executable call every now and then. Is
> there any way i can specify the appropriate flags at once (like we do
> for
> TARGET_LINK_LIBRARIES with debug and optimized flags).?

With a little swizzling from the CMake Useful Variables
http://www.cmake.org/Wiki/CMake_Useful_Variables you could do:

# set this early on
set(wingui WIN32)
if(MSVC AND CMAKE_CFG_INTDIR STREQUAL "/Debug")
  set(wingui)
endif(MSVC AND CMAKE_CFG_INTDIR STREQUAL "/Debug")

# use this style for all add_executable calls
add_executable(foo ${wingui} blah.c etc.c)


Cheers,
Brandon Van Every





>
> Surya
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list