summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-16 14:24:16 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-17 14:21:32 (GMT)
commite134e53b47fc9f0337529ce2b6851cec6319a8af (patch)
treea712dc8248b379139ca900a531f7a37bddc44057 /Source/cmcmd.cxx
parentda00be6359055ffdb2067a9ec1e817eb782ad145 (diff)
downloadCMake-e134e53b47fc9f0337529ce2b6851cec6319a8af.zip
CMake-e134e53b47fc9f0337529ce2b6851cec6319a8af.tar.gz
CMake-e134e53b47fc9f0337529ce2b6851cec6319a8af.tar.bz2
Add support for *.manifest source files with MSVC tools
Classify .manifest sources separately, add dependencies on them, and pass them to the MS manifest tool to merge with linker-generated manifest files. Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx21
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 307e78b..f44c77d 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1362,6 +1362,7 @@ class cmVSLink
bool Incremental;
bool LinkGeneratesManifest;
std::vector<std::string> LinkCommand;
+ std::vector<std::string> UserManifests;
std::string LinkerManifestFile;
std::string ManifestFile;
std::string ManifestFileRC;
@@ -1480,6 +1481,13 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
++arg;
break;
}
+ else if (*arg == "--manifests")
+ {
+ for (++arg; arg != argEnd && !cmHasLiteralPrefix(*arg, "-"); ++arg)
+ {
+ this->UserManifests.push_back(*arg);
+ }
+ }
else if (cmHasLiteralPrefix(*arg, "--intdir="))
{
intDir = arg->substr(9);
@@ -1544,10 +1552,11 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
this->ManifestFileRes = intDir + "/manifest.res";
this->LinkCommand.push_back(this->ManifestFileRes);
}
- else
+ else if (this->UserManifests.empty())
{
- // CMake places the linker-generated manifest next to the binary (as if it
- // were not to be embedded) when not linking incrementally.
+ // Prior to support for user-specified manifests CMake placed the
+ // linker-generated manifest next to the binary (as if it were not to be
+ // embedded) when not linking incrementally. Preserve this behavior.
this->ManifestFile = this->TargetFile + ".manifest";
this->LinkerManifestFile = this->ManifestFile;
}
@@ -1564,7 +1573,7 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
int cmVSLink::Link()
{
if (this->Incremental &&
- this->LinkGeneratesManifest)
+ (this->LinkGeneratesManifest || !this->UserManifests.empty()))
{
if (this->Verbose)
{
@@ -1688,7 +1697,7 @@ int cmVSLink::LinkNonIncremental()
}
// If we have no manifest files we are done.
- if (!this->LinkGeneratesManifest)
+ if (!this->LinkGeneratesManifest && this->UserManifests.empty())
{
return 0;
}
@@ -1709,6 +1718,8 @@ int cmVSLink::RunMT(std::string const& out, bool notify)
{
mtCommand.push_back(this->LinkerManifestFile);
}
+ mtCommand.insert(mtCommand.end(),
+ this->UserManifests.begin(), this->UserManifests.end());
mtCommand.push_back(out);
if (notify)
{