MantisBT - CMake
View Issue Details
0015867CMakeCMakepublic2015-11-30 05:172016-06-10 14:21
Marcel Beister 
Clinton Stimpson 
normalminoralways
closedfixed 
x64Microsoft Windows7
CMake 3.4 
 
0015867: Meta-projects generated for Visual Studio 2013 solutions are always multi-byte
Expected Behavior:
If "add_definitions(-D_UNICODE -DUNICODE)" was added to the CMakeList.txt, all project files for Visual Studio solutions should be marked as unicode.

Real Behavior:
While the behavior is as expected in Visual Studio 2008, at least Visual Studio 2013 does not show the expected behavior and sets meta projects (e.g. ZERO_CHECK) to multi-byte.

Problem:
Starting with Visual Studio 2013, MFC with multi-byte character set is marked deprecated and no longer possible without installing additional software.
* Create a simple CMake project
* Add "add_definitions(-D_UNICODE -DUNICODE)" to the CMakeList.txt
* Generate a Visual Studio 2013 solution
* Open the generate solution with Visual Studio
* Verify the character set of meta projects (e.g. ZERO_CHECK)
http://stackoverflow.com/questions/22011610/how-do-i-set-unicode-as-character-set-in-the-all-build-and-zero-check-visual-stu?lq=1 [^]
No tags attached.
Issue History
2015-11-30 05:17Marcel BeisterNew Issue
2015-11-30 09:48Brad KingAssigned To => Clinton Stimpson
2015-11-30 09:48Brad KingStatusnew => assigned
2015-11-30 10:27Clinton StimpsonNote Added: 0039919
2015-11-30 10:28Clinton StimpsonNote Edited: 0039919bug_revision_view_page.php?bugnote_id=39919#r1963
2015-11-30 11:20Marcel BeisterNote Added: 0039920
2015-11-30 11:27Clinton StimpsonNote Added: 0039922
2015-11-30 11:29Marcel BeisterNote Added: 0039923
2016-01-19 16:07Clinton StimpsonNote Added: 0040272
2016-01-19 16:07Clinton StimpsonStatusassigned => resolved
2016-01-19 16:07Clinton StimpsonResolutionopen => fixed
2016-06-10 14:21Kitware RobotNote Added: 0041277
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0039919)
Clinton Stimpson   
2015-11-30 10:27   
(edited on: 2015-11-30 10:28)
What is the problem? Are you getting a warning, error, unable to compile, or something else?

https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmVisualStudio10TargetGenerator.cxx;h=6e1fb5 [^]

From cmVisualStudio10TargetGenerator.cxx line 751 to 768, it appears CharacterSet will always be set to MultiByte for a UTILITY target. It seems that logic needs changed.

(0039920)
Marcel Beister   
2015-11-30 11:20   
With a plain Visual Studio 2013 installation I get the following error for all meta projects (if MFC is used and enabled in the project):

Error 1 error MSB8031: Use of MBCS encoding in MFC projects require an additional library to be downloaded and installed. Please see http://go.microsoft.com/fwlink/?LinkId=286820 [^] for more information. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\v120\Microsoft.CppBuild.targets

This forces me to either
* manually switch all meta projects from multi-byte to unicode (and do this every time when CMake detected changes)
* install the additional library although i do not use MFC with multi-byte characters (of course this is possible, but unnecessary; also this feature might be completely removed in future VS version)

The same problem is described here:
http://stackoverflow.com/questions/19603680/mbcs-error-building-mfc-c-project-with-visual-studio [^]
(0039922)
Clinton Stimpson   
2015-11-30 11:27   
Ok. So does that mean your simple cmake project is setting CMAKE_MFC_FLAG?
(0039923)
Marcel Beister   
2015-11-30 11:29   
Yes, I have "set(CMAKE_MFC_FLAG 2)" in my root CMakeList.txt file.
Sorry for not-mentioning this in my "Steps To Reproduce".
(0040272)
Clinton Stimpson   
2016-01-19 16:07   
https://cmake.org/gitweb?p=cmake.git;a=commit;h=a15e375c [^]
(0041277)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.