VS: Handle .pfx files explicitly in generator
Teach cmGeneratorTarget to classify .pfx files as package certificate key files. Teach cmVisualStudio10TargetGenerator to write them as PackageCertificateKeyFile in .vcxproj files. Inspired-by: Minmin Gong <minmin.gong@gmail.com>
This commit is contained in:
parent
23782171ad
commit
401269e43b
|
@ -54,6 +54,7 @@ struct IDLSourcesTag {};
|
|||
struct ResxTag {};
|
||||
struct ModuleDefinitionFileTag {};
|
||||
struct AppManifestTag{};
|
||||
struct CertificatesTag{};
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1310
|
||||
template<typename Tag, typename OtherTag>
|
||||
|
@ -200,6 +201,10 @@ struct TagVisitor
|
|||
{
|
||||
DoAccept<IsSameTag<Tag, AppManifestTag>::Result>::Do(this->Data, sf);
|
||||
}
|
||||
else if (ext == "pfx")
|
||||
{
|
||||
DoAccept<IsSameTag<Tag, CertificatesTag>::Result>::Do(this->Data, sf);
|
||||
}
|
||||
else if(this->Header.find(sf->GetFullPath().c_str()))
|
||||
{
|
||||
DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf);
|
||||
|
@ -442,6 +447,15 @@ cmGeneratorTarget
|
|||
IMPLEMENT_VISIT(AppManifest);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmGeneratorTarget
|
||||
::GetCertificates(std::vector<cmSourceFile const*>& data,
|
||||
const std::string& config) const
|
||||
{
|
||||
IMPLEMENT_VISIT(Certificates);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
|
||||
const std::string& config) const
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
const std::string& config) const;
|
||||
void GetAppManifest(std::vector<cmSourceFile const*>&,
|
||||
const std::string& config) const;
|
||||
void GetCertificates(std::vector<cmSourceFile const*>&,
|
||||
const std::string& config) const;
|
||||
|
||||
void ComputeObjectMapping();
|
||||
|
||||
|
|
|
@ -384,6 +384,7 @@ void cmVisualStudio10TargetGenerator::Generate()
|
|||
" Label=\"LocalAppDataPlatform\" />\n", 2);
|
||||
this->WriteString("</ImportGroup>\n", 1);
|
||||
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
|
||||
this->WriteWinRTPackageCertificateKeyFile();
|
||||
this->WritePathAndIncrementalLinkOptions();
|
||||
this->WriteItemDefinitionGroups();
|
||||
this->WriteCustomCommands();
|
||||
|
@ -2164,6 +2165,34 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
|
|||
this->WriteString("</ItemGroup>\n", 1);
|
||||
}
|
||||
|
||||
void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
|
||||
{
|
||||
if((this->GlobalGenerator->TargetsWindowsStore() ||
|
||||
this->GlobalGenerator->TargetsWindowsPhone())
|
||||
&& (cmTarget::EXECUTABLE == this->Target->GetType()))
|
||||
{
|
||||
std::string pfxFile;
|
||||
std::vector<cmSourceFile const*> certificates;
|
||||
this->GeneratorTarget->GetCertificates(certificates, "");
|
||||
for(std::vector<cmSourceFile const*>::const_iterator si =
|
||||
certificates.begin(); si != certificates.end(); ++si)
|
||||
{
|
||||
pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
|
||||
this->ConvertToWindowsSlash(pfxFile);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!pfxFile.empty())
|
||||
{
|
||||
this->WriteString("<PropertyGroup>\n", 1);
|
||||
this->WriteString("<", 2);
|
||||
(*this->BuildFileStream) << "PackageCertificateKeyFile>"
|
||||
<< pfxFile << "</PackageCertificateKeyFile>\n";
|
||||
this->WriteString("</PropertyGroup>\n", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool cmVisualStudio10TargetGenerator::
|
||||
IsResxHeader(const std::string& headerFile)
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
void WriteDotNetReferences();
|
||||
void WriteEmbeddedResourceGroup();
|
||||
void WriteWinRTReferences();
|
||||
void WriteWinRTPackageCertificateKeyFile();
|
||||
void WritePathAndIncrementalLinkOptions();
|
||||
void WriteItemDefinitionGroups();
|
||||
|
||||
|
|
Loading…
Reference in New Issue