[CMake] How do I tell cmake not to create a console window?

Ryan Pavlik rpavlik at iastate.edu
Mon May 3 09:00:05 EDT 2010


On 5/3/10 1:39 AM, Michael Wild wrote:
> This won't do, it will produce a console-window when the executable is double-clicked. Windows is a PITA. Perhaps something like:
>
> add_executable(simple WIN32 simple.c)
> set_source_files_properties(simple.c PROPERTIES
>    COMPILE_DEFINITIONS main=WinMain)
>
> Michael
>
> On 2. May, 2010, at 21:46 , Mike Jackson wrote:
>
>    
>> add_executable(simple simple.c)
>>
>> On Sun, May 2, 2010 at 10:20 AM, Mr Shore<shore.cloud at gmail.com>  wrote:
>>      
>>> I can achieve this by gcc :
>>>
>>> gcc -mwindows -o simple simple.c
>>>
>>>
>>> But only find this in cmake:
>>>
>>> add_executable(simple WIN32 simple.c)
>>>
>>> But it's not exactly the same as -mwindows,
>>>
>>> this will require the entry point to be WinMain,
>>>
>>> while gcc -mwindows doesn't require this.
>>>
>>> How should I do it properly?
>>>
>>>        
>
Well, the typical way _is_ to have WinMain as your entry point.  If that 
won't do, you can add -mwindows to CMAKE_C_FLAGS if you're on Windows 
and using GCC.

Ryan

-- 
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com/



More information about the CMake mailing list