View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012189CMakepublic2011-05-14 06:362012-07-09 06:52
ReporterStrimo 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0012189: It is not possible to generate a Visual Studio project with ASCII/SBCS character set
DescriptionIn Visual Studio 9.0 (and prior, 10.0 i don't know) it is possible specify three different character sets for your project within the project properties:

Not Set = ASCII/SBCS (Single Byte Character Set)
Unicode
Multi-Byte

Depending on the option different preprocessor defines are set (http://msdn.microsoft.com/en-us/library/c426s321(v=vs.80).aspx [^]):

SBCS: neither _UNICODE nor _MBCS defined
Unicode: _UNICODE defined
Multi_Byte: _MBCS defined

The character set settings is stored within the vs proj files as an xml attribute:

SBCS: CharacterSet="0"
Unicode: CharacterSet="1"
Multi-Byte: CharacterSet="2"

However, the cmake visual studio generators do not support generating of projects with CharacterSet="0" (see cmLocalVisualStudio7Generator.cxx line 730). At the moment the generators select unicode if a _UNICODE macro has been set by add_definitions, otherwise multi-byte is selected.

To solve the problem and to keep backwards compatability, i suggest to define the _MBCS macro by default for the visual studio generators and to set CharacterSet="2" only if this macro is still available and otherwise CharacterSet="0". In that case the user can remove the _MBCS macro by remove_definitions and select this way the SBCS. If the user adds _UNICODE by add_definitions CharacterSet="1" should be selected and the conflicting _MBCS macro must be deleted by the code generator.
Tags2005, 2008, 2010, CharacterSet, visual studio, visual studio 2010
Attached Filespatch file icon SBCS.patch [^] (2,522 bytes) 2011-06-21 10:43 [Show Content]
patch file icon SBCS-revised.patch [^] (2,584 bytes) 2011-06-22 19:58 [Show Content]
patch file icon SBCS_With_Test.patch [^] (4,371 bytes) 2011-09-01 11:24 [Show Content]
? file icon SBCS_git [^] (4,857 bytes) 2012-02-16 16:29 [Show Content]

 Relationships

  Notes
(0026938)
Aaron C. Meadows (reporter)
2011-06-21 10:42

I dug into this bug and confirmed that there is no way to set the "Not Set" state. In the 2.8.4 source, the lines in question are:
  cmLocalVisualStudio7Generator.cxx line 730
  cmVisualStudio10TargetGenerator.cxx line 287

I've created a patch which allows this behavior by checking for _SBCS to be defined, in which case it writes the correct "Not Set" settings to the files.
(0026955)
Aaron C. Meadows (reporter)
2011-06-22 19:59

I uploaded a revised patch file.
  + Corrected a stale comment
  + Corrected an if statement which caused a bad pointer dereference
(0027317)
Aaron C. Meadows (reporter)
2011-09-01 11:24

Uploaded new patch which includes adding a test

(and it should be in the correct sense now!)
(0027830)
Vladislav (reporter)
2011-11-19 04:38

Tell please, whether it is planned to add this patch in version 2.8.7?
(0028579)
John Grant (reporter)
2012-02-13 13:25

I am suffering from this issue also. Thanks for making the patch. Will it be applied in version 2.8.8?
(0028612)
Aaron C. Meadows (reporter)
2012-02-16 16:30

Attached Git patch to fix this issue.
(0028615)
David Cole (manager)
2012-02-17 11:34

Fix pushed to stage and merged to 'next':

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba89e92ba622ed821a6adf31e8a6633d574ff656 [^]
(0029976)
David Cole (manager)
2012-07-09 06:52

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-05-14 06:36 Strimo New Issue
2011-06-21 10:42 Aaron C. Meadows Note Added: 0026938
2011-06-21 10:43 Aaron C. Meadows File Added: SBCS.patch
2011-06-21 10:43 Aaron C. Meadows Tag Attached: visual studio 2010
2011-06-21 10:43 Aaron C. Meadows Tag Attached: 2010
2011-06-21 10:43 Aaron C. Meadows Tag Attached: visual studio
2011-06-21 10:44 Aaron C. Meadows Tag Attached: 2005
2011-06-21 10:44 Aaron C. Meadows Tag Attached: 2008
2011-06-21 10:45 Aaron C. Meadows Tag Attached: CharacterSet
2011-06-22 19:58 Aaron C. Meadows File Added: SBCS-revised.patch
2011-06-22 19:59 Aaron C. Meadows Note Added: 0026955
2011-08-31 12:02 David Cole Assigned To => David Cole
2011-08-31 12:02 David Cole Status new => assigned
2011-09-01 11:24 Aaron C. Meadows File Added: SBCS_With_Test.patch
2011-09-01 11:24 Aaron C. Meadows Note Added: 0027317
2011-11-19 04:38 Vladislav Note Added: 0027830
2012-02-13 13:25 John Grant Note Added: 0028579
2012-02-16 16:29 Aaron C. Meadows File Added: SBCS_git
2012-02-16 16:30 Aaron C. Meadows Note Added: 0028612
2012-02-17 11:33 David Cole Target Version => CMake 2.8.8
2012-02-17 11:34 David Cole Note Added: 0028615
2012-02-17 11:34 David Cole Status assigned => resolved
2012-02-17 11:34 David Cole Fixed in Version => CMake 2.8.8
2012-02-17 11:34 David Cole Resolution open => fixed
2012-07-09 06:52 David Cole Note Added: 0029976
2012-07-09 06:52 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team