Quantcast

CMake stripping "/SUBSYSTEM" out of LINK_FLAGS

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CMake stripping "/SUBSYSTEM" out of LINK_FLAGS

cowwoc
Hi,

I'm using CMAKE 2.8.6 with Visual Studio 2010 Express. According to http://www.cmake.org/Wiki/VSConfigSpecificSettings I should be able run:

  set_target_properties(main PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")

where "main" is my project, but I've discovered that CMake strips "/SUBSYSTEM:WINDOWS" silently and never passes it to the linker. By contrast, if I run:

set_target_properties(main PROPERTIES LINK_FLAGS "/SUBSYSTEM:foo")

  it reaches the linker. I can't simply add WIN32 to add_executable() because I want debug builds to use the console sub-system and release builds to use the windows subsystem. I have three questions:

1. Why CMake is stripping this flag?
2. Why is it not issuing a warning of some sort?
3. How do I override SUBSYSTEM as suggested by this Wiki entry?

Thanks,
Gili
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake stripping "/SUBSYSTEM" out of LINK_FLAGS

cowwoc
cowwoc wrote
Hi,

I'm using CMAKE 2.8.6 with Visual Studio 2010 Express. According to http://www.cmake.org/Wiki/VSConfigSpecificSettings I should be able run:

  set_target_properties(main PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")

where "main" is my project, but I've discovered that CMake strips "/SUBSYSTEM:WINDOWS" silently and never passes it to the linker. By contrast, if I run:

set_target_properties(main PROPERTIES LINK_FLAGS "/SUBSYSTEM:foo")

  it reaches the linker. I can't simply add WIN32 to add_executable() because I want debug builds to use the console sub-system and release builds to use the windows subsystem. I have three questions:

1. Why CMake is stripping this flag?
2. Why is it not issuing a warning of some sort?
3. How do I override SUBSYSTEM as suggested by this Wiki entry?

Thanks,
Gili
Looks like a bug that's been open for over a year now: http://public.kitware.com/Bug/view.php?id=11171

Any chance of increasing the priority of this bug?

Gili
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake stripping "/SUBSYSTEM" out of LINK_FLAGS

Jens Auer-2
Hi,

> >   it reaches the linker. I can't simply add WIN32 to
> add_executable()
> > because I want debug builds to use the console sub-system
> and release
> > builds to use the windows subsystem. I have three questions:

I don't have a solution in cmake, but I worked around this using code from here: http://www.halcyon.com/~ast/dload/guicon.htm.
It shows how to open a console window and redirect the output. It also has the benefit that the debug build is closer to release builds and that the entry point definition is more in line with the windows documentation (SUBSYSTEM:WINDOWS -> WinMain, SUBSYSTEM:CONSOLE -> main).

Best regards,
  Jens
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Loading...