mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
cmcldeps: Do not pass linker flags to cl
Avoid cl `Command line warning D9035`. Fixes: #24906 Co-authored-by: Brad King <brad.king@kitware.com>
This commit is contained in:
@@ -176,21 +176,6 @@ static void outputDepFile(const std::string& dfile, const std::string& objfile,
|
|||||||
fclose(out);
|
fclose(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains(const std::string& str, const std::string& what)
|
|
||||||
{
|
|
||||||
return str.find(what) != std::string::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string replace(const std::string& str, const std::string& what,
|
|
||||||
const std::string& replacement)
|
|
||||||
{
|
|
||||||
size_t pos = str.find(what);
|
|
||||||
if (pos == std::string::npos)
|
|
||||||
return str;
|
|
||||||
std::string replaced = str;
|
|
||||||
return replaced.replace(pos, what.size(), replacement);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int process(cm::string_view srcfilename, const std::string& dfile,
|
static int process(cm::string_view srcfilename, const std::string& dfile,
|
||||||
const std::string& objfile, const std::string& prefix,
|
const std::string& objfile, const std::string& prefix,
|
||||||
const std::string& cmd, const std::string& dir = "",
|
const std::string& cmd, const std::string& dir = "",
|
||||||
@@ -266,10 +251,11 @@ int main()
|
|||||||
// "misuse" cl.exe to get headers from .rc files
|
// "misuse" cl.exe to get headers from .rc files
|
||||||
std::string clrest = " /nologo /showIncludes " + rest;
|
std::string clrest = " /nologo /showIncludes " + rest;
|
||||||
|
|
||||||
// rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj
|
// rc /fo X.dir\x.rc.res => cl -FoX.dir\x.rc.res.obj
|
||||||
clrest = replace(clrest, "/fo ", "/out:");
|
// The object will not actually be written.
|
||||||
clrest = replace(clrest, "-fo ", "-out:");
|
cmSystemTools::ReplaceString(clrest, "/fo ", " ");
|
||||||
clrest = replace(clrest, objfile, objfile + ".dep.obj ");
|
cmSystemTools::ReplaceString(clrest, "-fo ", " ");
|
||||||
|
cmSystemTools::ReplaceString(clrest, objfile, "-Fo" + objfile + ".obj");
|
||||||
|
|
||||||
cl = "\"" + cl + "\" /P /DRC_INVOKED /TC ";
|
cl = "\"" + cl + "\" /P /DRC_INVOKED /TC ";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user