[Cmake-commits] [cmake-commits] king committed cmVisualStudio10TargetGenerator.cxx 1.24 1.25 cmVisualStudio10TargetGenerator.h 1.9 1.10
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Oct 23 11:34:41 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv4661/Source
Modified Files:
cmVisualStudio10TargetGenerator.cxx
cmVisualStudio10TargetGenerator.h
Log Message:
Detect and set Unicode character set in VS 10
This commit teaches the VS 10 generator to detect the -D_UNICODE option
in preprocessor definitions and set the CharacterSet attribute to the
value 'Unicode'. This was already done for other VS IDE versions.
See issue #9769
Index: cmVisualStudio10TargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudio10TargetGenerator.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C 2 -d -r1.9 -r1.10
*** cmVisualStudio10TargetGenerator.h 22 Oct 2009 12:24:11 -0000 1.9
--- cmVisualStudio10TargetGenerator.h 23 Oct 2009 15:34:37 -0000 1.10
***************
*** 22,25 ****
--- 22,26 ----
class cmLocalVisualStudio7Generator;
class cmComputeLinkInformation;
+ class cmVisualStudioGeneratorOptions;
#include "cmSourceGroup.h"
***************
*** 50,53 ****
--- 51,56 ----
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
+ void ComputeClOptions();
+ void ComputeClOptions(std::string const& configName);
void WriteClOptions(std::string const& config,
std::vector<std::string> const & includes);
***************
*** 76,79 ****
--- 79,85 ----
std::vector<cmSourceGroup>& );
private:
+ typedef cmVisualStudioGeneratorOptions Options;
+ typedef std::map<cmStdString, Options*> OptionsMap;
+ OptionsMap ClOptions;
std::string ModuleDefinitionFile;
std::string PathToVcxproj;
Index: cmVisualStudio10TargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudio10TargetGenerator.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -C 2 -d -r1.24 -r1.25
*** cmVisualStudio10TargetGenerator.cxx 23 Oct 2009 15:33:27 -0000 1.24
--- cmVisualStudio10TargetGenerator.cxx 23 Oct 2009 15:34:36 -0000 1.25
***************
*** 23,26 ****
--- 23,28 ----
#include "cmVS10LibFlagTable.h"
+ #include <cmsys/auto_ptr.hxx>
+
static std::string cmVS10EscapeXML(std::string arg)
{
***************
*** 51,54 ****
--- 53,61 ----
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
{
+ for(OptionsMap::iterator i = this->ClOptions.begin();
+ i != this->ClOptions.end(); ++i)
+ {
+ delete i->second;
+ }
if(!this->BuildFileStream)
{
***************
*** 117,120 ****
--- 124,131 ----
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj");
+ if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY)
+ {
+ this->ComputeClOptions();
+ }
cmMakefile* mf = this->Target->GetMakefile();
std::string path = mf->GetStartOutputDirectory();
***************
*** 238,242 ****
this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
}
! this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
this->WriteString("</PropertyGroup>\n", 1);
}
--- 249,261 ----
this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
}
! if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
! this->ClOptions[*i]->UsingUnicode())
! {
! this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
! }
! else
! {
! this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
! }
this->WriteString("</PropertyGroup>\n", 1);
}
***************
*** 832,850 ****
}
! void
! cmVisualStudio10TargetGenerator::
! WriteClOptions(std::string const& configName,
! std::vector<std::string> const & includes)
{
-
// much of this was copied from here:
// copied from cmLocalVisualStudio7Generator.cxx 805
- this->WriteString("<ClCompile>\n", 2);
- cmVisualStudioGeneratorOptions
- clOptions(this->LocalGenerator,
- 10, cmVisualStudioGeneratorOptions::Compiler,
- cmVS10CLFlagTable);
std::string flags;
// collect up flags for
--- 851,879 ----
}
+ //----------------------------------------------------------------------------
+ void cmVisualStudio10TargetGenerator::ComputeClOptions()
+ {
+ std::vector<std::string> const* configs =
+ this->GlobalGenerator->GetConfigurations();
+ for(std::vector<std::string>::const_iterator i = configs->begin();
+ i != configs->end(); ++i)
+ {
+ this->ComputeClOptions(*i);
+ }
+ }
! //----------------------------------------------------------------------------
! void cmVisualStudio10TargetGenerator::ComputeClOptions(
! std::string const& configName)
{
// much of this was copied from here:
// copied from cmLocalVisualStudio7Generator.cxx 805
+ // TODO: Integrate code below with cmLocalVisualStudio7Generator.
+
+ cmsys::auto_ptr<Options> pOptions(
+ new Options(this->LocalGenerator, 10, Options::Compiler,
+ cmVS10CLFlagTable));
+ Options& clOptions = *pOptions;
std::string flags;
// collect up flags for
***************
*** 916,919 ****
--- 945,959 ----
clOptions.AddDefine(exportMacro);
}
+
+ this->ClOptions[configName] = pOptions.release();
+ }
+
+ //----------------------------------------------------------------------------
+ void cmVisualStudio10TargetGenerator::WriteClOptions(
+ std::string const& configName,
+ std::vector<std::string> const& includes)
+ {
+ Options& clOptions = *(this->ClOptions[configName]);
+ this->WriteString("<ClCompile>\n", 2);
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
this->OutputIncludes(includes);
More information about the Cmake-commits
mailing list