mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-05 22:28:35 -06:00
Ninja: Fix POST_BUILD noop on Windows
Use `cd .` instead of `:` in a Windows shell. Closes: #16393
This commit is contained in:
@@ -34,6 +34,11 @@
|
|||||||
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
|
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
|
||||||
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
|
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
|
||||||
const char* cmGlobalNinjaGenerator::INDENT = " ";
|
const char* cmGlobalNinjaGenerator::INDENT = " ";
|
||||||
|
#ifdef _WIN32
|
||||||
|
std::string const cmGlobalNinjaGenerator::SHELL_NOOP = "cd .";
|
||||||
|
#else
|
||||||
|
std::string const cmGlobalNinjaGenerator::SHELL_NOOP = ":";
|
||||||
|
#endif
|
||||||
|
|
||||||
void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count)
|
void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ public:
|
|||||||
/// The indentation string used when generating Ninja's build file.
|
/// The indentation string used when generating Ninja's build file.
|
||||||
static const char* INDENT;
|
static const char* INDENT;
|
||||||
|
|
||||||
|
/// The shell command used for a no-op.
|
||||||
|
static std::string const SHELL_NOOP;
|
||||||
|
|
||||||
/// Write @a count times INDENT level to output stream @a os.
|
/// Write @a count times INDENT level to output stream @a os.
|
||||||
static void Indent(std::ostream& os, int count);
|
static void Indent(std::ostream& os, int count);
|
||||||
|
|
||||||
|
|||||||
@@ -299,15 +299,11 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(
|
|||||||
std::string cmLocalNinjaGenerator::BuildCommandLine(
|
std::string cmLocalNinjaGenerator::BuildCommandLine(
|
||||||
const std::vector<std::string>& cmdLines)
|
const std::vector<std::string>& cmdLines)
|
||||||
{
|
{
|
||||||
// If we have no commands but we need to build a command anyway, use ":".
|
// If we have no commands but we need to build a command anyway, use noop.
|
||||||
// This happens when building a POST_BUILD value for link targets that
|
// This happens when building a POST_BUILD value for link targets that
|
||||||
// don't use POST_BUILD.
|
// don't use POST_BUILD.
|
||||||
if (cmdLines.empty()) {
|
if (cmdLines.empty()) {
|
||||||
#ifdef _WIN32
|
return cmGlobalNinjaGenerator::SHELL_NOOP;
|
||||||
return "cd .";
|
|
||||||
#else
|
|
||||||
return ":";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream cmd;
|
std::ostringstream cmd;
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
if (!symlinkNeeded) {
|
if (!symlinkNeeded) {
|
||||||
vars["POST_BUILD"] = postBuildCmdLine;
|
vars["POST_BUILD"] = postBuildCmdLine;
|
||||||
} else {
|
} else {
|
||||||
vars["POST_BUILD"] = ":";
|
vars["POST_BUILD"] = cmGlobalNinjaGenerator::SHELL_NOOP;
|
||||||
symlinkVars["POST_BUILD"] = postBuildCmdLine;
|
symlinkVars["POST_BUILD"] = postBuildCmdLine;
|
||||||
}
|
}
|
||||||
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
|
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
|
||||||
|
|||||||
Reference in New Issue
Block a user