[cmake-developers] Making GUI applications by default
Stephen Kelly
steveire at gmail.com
Fri Feb 17 05:44:24 EST 2012
Eric Noulard wrote:
> 2012/2/17 Stephen Kelly
> <steveire at gmail.com>:
>>
>> Hi there,
>>
>> Also in this thread one of the discussion topics was making CMake default
>> to creating Gui-ready executables. That is, setting the WIN32_EXECUTABLE
>> or MACOSX_BUNDLE property on the executable target.
>>
>> http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/6961/focus=7005
>>
>> By default CMake does not set those properties, which is actually
>> uncommon. Generally in KDE at least, only unit tests and some small
>> utilities are non- gui executables.
>>
>> We'd like to be able to specify with a defaultProperty something like
>>
>> set(CMAKE_CREATE_GUI_EXECUTABLES ON)
>
> You probably mean:
>
> set_property(GLOBAL PROPERTY CMAKE_CREATE_GUI_EXECUTABLES ON)
Nope, I meant the one I wrote. It'a similar to, eg, set(CMAKE_AUTOMOC ON)
and many others.
>
>> which would set those target properties to True on the Windows and Mac
>> platforms by default. For unit tests, we could then disable it again.
>>
>> Thoughts/comments?
>
> I have [at least] one project which build on Windows where some
> applications (not test)
> are not GUI apps. In fact those applications are seldom launched by
> the user because
> they are "forked" by some GUI apps.
>
> If this was set by default would my apps still be working as expected?
If you change nothing they will continue to work as expected.
If you add set(CMAKE_CREATE_GUI_EXECUTABLES ON) then you would have to use
set_target_property(foo WIN32_EXECUTABLE 0) on the non-gui executable in the
project.
Note that I think I caused confusion for you when I wrote 'by default'. I
didn't actually mean that CMake should change its default behaviour in a
source incompatible way. I meant 'default' in the sense of
cmTarget::SetPropertyDefault, in the same way that set(CMAKE_AUTOMOC ON)
sets the AUTOMOC property to true by default for all targets that follow.
> or shall I
> put "NON-GUI" properties on them?
>
> If this was to be introduced I bet the default value of the property
> should be OFF (or not SET)
> for backward compatibility reason.
Of course. I don't intend to change the default behaviour of CMake, just the
default value of the property *if* set(CMAKE_CREATE_GUI_EXECUTABLES) is ON.
Thanks,
Steve.
More information about the cmake-developers
mailing list