diff options
author | Mateusz Zych <mte.zych@gmail.com> | 2018-10-25 00:34:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-29 17:40:47 (GMT) |
commit | bd9bfc644954a48b1bf7ea18fc260a1231840671 (patch) | |
tree | 983bc115307da95ae78550b515d26ae324274359 /Source/cmcmd.cxx | |
parent | 0033676796748bd8fe00f3f96d3470405cdb94fe (diff) | |
download | CMake-bd9bfc644954a48b1bf7ea18fc260a1231840671.zip CMake-bd9bfc644954a48b1bf7ea18fc260a1231840671.tar.gz CMake-bd9bfc644954a48b1bf7ea18fc260a1231840671.tar.bz2 |
MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}
CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC,
are responsible for calling resource compiler and manifest tool.
Before this commit, both of these tools were called directly, with the
expectation that they are available in the `PATH`. This has been fixed
by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT`
defining paths to these tools.
Fixes: #17804
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r-- | Source/cmcmd.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 1d2f741..9f1618b 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1517,6 +1517,8 @@ class cmVSLink std::string ManifestFileRC; std::string ManifestFileRes; std::string TargetFile; + std::string MtPath; + std::string RcPath; public: cmVSLink(int type, bool verbose) @@ -1660,6 +1662,12 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg, } else if (cmHasLiteralPrefix(*arg, "--intdir=")) { intDir = arg->substr(9); ++arg; + } else if (cmHasLiteralPrefix(*arg, "--rc=")) { + this->RcPath = arg->substr(5); + ++arg; + } else if (cmHasLiteralPrefix(*arg, "--mt=")) { + this->MtPath = arg->substr(5); + ++arg; } else { std::cerr << "unknown argument '" << *arg << "'\n"; return false; @@ -1799,7 +1807,7 @@ int cmVSLink::LinkIncremental() // Compile the resource file. std::vector<std::string> rcCommand; - rcCommand.push_back("rc"); + rcCommand.push_back(this->RcPath.empty() ? "rc" : this->RcPath); rcCommand.push_back("/fo" + this->ManifestFileRes); rcCommand.push_back(this->ManifestFileRC); if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) { @@ -1858,7 +1866,7 @@ int cmVSLink::LinkNonIncremental() int cmVSLink::RunMT(std::string const& out, bool notify) { std::vector<std::string> mtCommand; - mtCommand.push_back("mt"); + mtCommand.push_back(this->MtPath.empty() ? "mt" : this->MtPath); mtCommand.push_back("/nologo"); mtCommand.push_back("/manifest"); if (this->LinkGeneratesManifest) { |