[CMake] WIN32_EXECUTABLE property with generator expression

Petr Kmoch petr.kmoch at gmail.com
Sun May 13 08:34:59 EDT 2018


Hi Surya.

Generator expressions are not supported universally in CMake; only some
properties support them, and they are all documented as doing so.
WIN32_EXECUTABLE does not support genexes.

As for a workaround, you could create two executable targets, one which
would only be built in Release and one which would be built in other
configurations. Properties such as EXCLUDE_FROM_ALL and
EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> might come in handy.

However, I find the whole concept somewhat strange. Why is your executable
so fundamentally different between Release and other configurations?
Perhaps there is a different way of achieving your actual goal, without a
need for this.

Petr

On 13 May 2018 at 13:12, Surya Kiran Gullapalli <
suryakiran.gullapalli at gmail.com> wrote:

> With Cmake-3.11.1 and Visual Studio 2017 generator, I'm trying to set
> WIN32_EXECUTABLE property on executable only for release mode with
> generator expression like this
>
> set_target_properties(target PROPERTIES WIN32_EXECUTABLE $<CONFIG:Release>)
>
> The generator expression doesn't seem to be working as I see
> /SUBSYSTEM:CONSOLE link flag for both Debug and Release configurations.
>
> set_target_properties(target PROPERTIES WIN32_EXECUTABLE 1)  is working
> though.
>
> Please help.
> Thanks,
> Surya
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180513/e0bb329f/attachment-0001.html>


More information about the CMake mailing list