The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15917 
====================================================================== 
Reported By:                Daniel Williams
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15917
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-01-13 18:16 EST
Last Modified:              2016-01-13 18:16 EST
====================================================================== 
Summary:                    Visual Studio project files generated incorrectly
Description: 
Executables are incorrectly flagged as Application executables (i.e. to use
winMain) instead of utility / console executables (and use the normal main)

when cmake is generating solution (.sln) and project (.vcxproj) files for Visual
Studio, it cannot set the flags correctly.  The generator creates: 
    <ConfigurationType>Application</ConfigurationType>

Instead of:
    <ConfigurationType>Utility</ConfigurationType>

This in turn causes compile-time Link Errors 

As it should.  This is controlled by a flag on the executable. (or so says the
documentation): 
[1]https://cmake.org/cmake/help/v3.4/command/add_executable.html
[2]https://cmake.org/cmake/help/v3.4/prop_tgt/WIN32_EXECUTABLE.html






Steps to Reproduce: 
1) create empty project with supplied CMakeLists.txt
2) create a minimal 'main.cpp'  (contents don't matter, empty should be fine)
3) run configure ; run generate
4) inspect $BUILD_DIR/test.exe.vcxproj
   DOM: Project/PropertyGroup/ConfigurationType values will all still be set to
"Application" which requires the winmain symbol be defined.  

This Application tag is generated both with and without the WIN32 flag.  It is
only supposed to be generated *with*.  (Without the flag, the
'ConfigurationType' tag should be set to 'Utility', the console exe version.)

Additional Information: 
1) Originally Reproduced as far back as CMake 3.1.2
2) the 'set_executable(...)' function correctly sets the flag, as checked by
'get_target_property(...)', but this property does not carry through to the file
generation stage.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-01-13 18:16 Daniel WilliamsNew Issue                                    
2016-01-13 18:16 Daniel WilliamsFile Added: CMakeLists.txt                    
======================================================================

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to