I've read on CMake's documentation that when calling add_executable
, you can set the executable type to be Win32 by doing add_executable(target WIN32 source.cpp)
. I also know that you should use CMake generator expressions to check for build configurations like so:
target_compile_definitions(target PUBLIC
$<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:Release>:RELEASE>
)
However this won't work with add_executable
. It treats it as a source file when I do add_executable(target $<$<CONFIG:Release>:WIN32> source.cpp)
and so it fails. What is the correct way of doing setting the executable type to WIN32 only in release mode?