Jason Eubank schrieb:
Hello,

I am wondering if it is possible to set the target property 'WIN32_EXECUTABLE' on a per-config basis (i.e. you can set link-flags on a per-config basis using LINK_FLAGS_<Config>). From reading the documentation this does not seem possible and if you set this property then all configurations (in Visual Studio) use the same subsystem setting.
I don't know whether or not CMake is able to set a property on a per-configuration basis. I doubt this is possible (yet), but could be that I'm wrong here.

But you could simply set the appropriate flags for a console/win32 application yourself, without using this flag at all. The only differences I could find between a win32 application and a console application are - Linker flag: "/SUBSYSTEM:CONSOLE" for console apps and "/SUBSYSTEM:WINDOWS" for win32 apps
- Preprocessor definition: '_CONSOLE' for console apps

Setting these using LINK_FLAGS_<Config> and COMPILE_DEFINITIONS_<Config> should do exactly what you want. The only problem I see that could possibly arise is that you can't depend on the WIN32_EXECUTABLE flag in your CMake file(s) anymore, to test for it or use it in any other way later.

Another solution that comes to my mind is to always create a win32 application, and then open a console window later by using the win32 function 'AllocConsole' in your code. I never really needed this, but I know those functions are there to create or attach a console window to a win32 application. Have a look at the documentation for this function.

Stefan

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to