Which compiler do you use?
With MinGW it works fine with
project(PRJ)
cmake_minimum_required(VERSION 2.8)
set(EXE_NAME prj)
set (prj_SRC
main.cpp
)
add_executable(${EXE_NAME} ${prj_SRC})
set_target_properties(
${EXE_NAME}
PROPERTIES
WIN32_EXECUTABLE TRUE
)
project(PRJ)
cmake_minimum_required(VERSION 2.8)
set(EXE_NAME prj)
set (prj_SRC
main.cpp
)
add_executable(${EXE_NAME} ${prj_SRC})
set_target_properties(
${EXE_NAME}
PROPERTIES
WIN32_EXECUTABLE TRUE
)
To copy to clipboard, switch view to plain text mode
When I set WIN32_EXECUTABLE to TRUE I obtain (make VEBOSE=1) this
C:\MinGW\bin\g++.exe -g -mwindows -Wl,--whole-archive CMakeFiles\prj.dir/objects.a -Wl,--no-whole-archive -o prj.exe -Wl,--out-implib,libprj.dll.a
-Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
C:\MinGW\bin\g++.exe -g -mwindows -Wl,--whole-archive CMakeFiles\prj.dir/objects.a -Wl,--no-whole-archive -o prj.exe -Wl,--out-implib,libprj.dll.a
-Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
To copy to clipboard, switch view to plain text mode
with WIN32_EXECUTABLE to FALSE the result is
C:\MinGW\bin\g++.exe -g -Wl,--whole-archive CMakeFiles\prj.dir/objects.a -Wl,--no-whole-archive -o prj.exe -Wl,--out-implib,libprj.dll.a
-Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
C:\MinGW\bin\g++.exe -g -Wl,--whole-archive CMakeFiles\prj.dir/objects.a -Wl,--no-whole-archive -o prj.exe -Wl,--out-implib,libprj.dll.a
-Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
To copy to clipboard, switch view to plain text mode
Bookmarks