Issuing linker flags in CMake's target_link_options is still omitting the necessary wraps

1 day ago 2
ARTICLE AD BOX

I'm trying to specify both /SUBSYSTEM:WINDOWS and /ENTRY:wmainCRTStartup as linking options in my application executable target in the best possible (portable) way.

It's no secret that when using these with the GNU-style Clang interface under Windows, the linker will issue errors similar to this one:

[build] clang: error: no such file or directory: '/ENTRY:wmainCRTStartup'

While the first (/SUBSYSTEM:WINDOWS) case is solved with the primary target specification as such:

add_executable(target WIN32 main.cpp ...)

The /ENTRY:wmainCRTStartup case can be trickier since there's no dedicated option for it and plainly using a code below will still trigger issue:

target_link_options(${target} PRIVATE /ENTRY:wmainCRTStartup)
Read Entire Article