[cmake-developers] [CMake 0012189]: It is not possible to generate a Visual Studio project with ASCII/SBCS character set

Mantis Bug Tracker mantis at public.kitware.com
Sat May 14 06:36:06 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12189 
====================================================================== 
Reported By:                Strimo
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12189
Category:                   
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-05-14 06:36 EDT
Last Modified:              2011-05-14 06:36 EDT
====================================================================== 
Summary:                    It is not possible to generate a Visual Studio
project with ASCII/SBCS character set
Description: 
In 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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-14 06:36 Strimo         New Issue                                    
======================================================================




More information about the cmake-developers mailing list