generator expression $<$<BOOL:MSVC>:dllmain.c> evaluate to dllmain.c on linux

All is in title.
$<$< BOOL:MSVC>:dllmain.c> evaluate to dllmain.c on Windows which is expected, However, it evaluated to dllmain.c on linux too. Why ?

I use cmake 3.18 on both windows and linux.

MSVC is a variable, so it must be evaluated:

$<$< BOOL:${MSVC}>:dllmain.c> 

But it is preferable to use more reliable method by targeting only the compiler you expect:

1 Like

I think you likely want $<PLATFORM_ID:Windows> since even when MinGW is in use, that file should be included.

Thank you all