mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
instrumentation: Disable preBuild and postBuild hooks on Windows
The implementation does not work on Windows. Issue: #26668
This commit is contained in:
@@ -117,10 +117,10 @@ optional.
|
||||
should be one of the following:
|
||||
|
||||
* ``postGenerate``
|
||||
* ``preBuild`` (:ref:`Ninja Generators`. only, when ``ninja`` is invoked)
|
||||
* ``postBuild`` (:ref:`Ninja Generators`. only, when ``ninja`` completes)
|
||||
* ``preCMakeBuild`` (when ``cmake --build`` is invoked)
|
||||
* ``postCMakeBuild`` (when ``cmake --build`` completes)
|
||||
* ``preBuild`` (called when ``ninja`` is invoked; unavailable on Windows)
|
||||
* ``postBuild`` (called when ``ninja`` completes; unavailable on Windows)
|
||||
* ``preCMakeBuild`` (called when ``cmake --build`` is invoked)
|
||||
* ``postCMakeBuild`` (called when ``cmake --build`` completes)
|
||||
* ``postInstall``
|
||||
* ``postTest``
|
||||
|
||||
|
||||
@@ -1762,7 +1762,8 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
|
||||
this->WriteTargetRebuildManifest(os);
|
||||
this->WriteTargetClean(os);
|
||||
this->WriteTargetHelp(os);
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
|
||||
// FIXME(#26668) This does not work on Windows
|
||||
if (this->GetCMakeInstance()
|
||||
->GetInstrumentation()
|
||||
->HasPreOrPostBuildHook()) {
|
||||
@@ -1843,7 +1844,8 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
|
||||
}
|
||||
reBuild.ImplicitDeps.push_back(this->CMakeCacheFile);
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
|
||||
// FIXME(#26668) This does not work on Windows
|
||||
if (this->GetCMakeInstance()
|
||||
->GetInstrumentation()
|
||||
->HasPreOrPostBuildHook()) {
|
||||
@@ -2196,6 +2198,8 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
|
||||
// FIXME(#26668) This does not work on Windows
|
||||
void cmGlobalNinjaGenerator::WriteTargetInstrument(std::ostream& os)
|
||||
{
|
||||
// Write rule
|
||||
@@ -2204,13 +2208,11 @@ void cmGlobalNinjaGenerator::WriteTargetInstrument(std::ostream& os)
|
||||
rule.Command = cmStrCat(
|
||||
"\"", cmSystemTools::GetCTestCommand(), "\" --start-instrumentation \"",
|
||||
this->GetCMakeInstance()->GetHomeOutputDirectory(), "\"");
|
||||
#ifndef _WIN32
|
||||
/*
|
||||
* On Unix systems, Ninja will prefix the command with `/bin/sh -c`.
|
||||
* Use exec so that Ninja is the parent process of the command.
|
||||
*/
|
||||
rule.Command = cmStrCat("exec ", rule.Command);
|
||||
#endif
|
||||
rule.Description = "Collecting build metrics";
|
||||
rule.Comment = "Rule to initialize instrumentation daemon.";
|
||||
rule.Restat = "1";
|
||||
@@ -2231,6 +2233,7 @@ void cmGlobalNinjaGenerator::WriteTargetInstrument(std::ostream& os)
|
||||
WriteBuild(os, instrument);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void cmGlobalNinjaGenerator::InitOutputPathPrefix()
|
||||
{
|
||||
|
||||
@@ -536,7 +536,10 @@ private:
|
||||
void WriteTargetRebuildManifest(std::ostream& os);
|
||||
bool WriteTargetCleanAdditional(std::ostream& os);
|
||||
void WriteTargetClean(std::ostream& os);
|
||||
#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
|
||||
// FIXME(#26668) This does not work on Windows
|
||||
void WriteTargetInstrument(std::ostream& os);
|
||||
#endif
|
||||
void WriteTargetHelp(std::ostream& os);
|
||||
|
||||
void ComputeTargetDependsClosure(
|
||||
|
||||
@@ -115,6 +115,8 @@ instrument(cmake-command-bad-arg NO_WARN)
|
||||
instrument(cmake-command-parallel-install
|
||||
BUILD INSTALL TEST NO_WARN INSTALL_PARALLEL DYNAMIC_QUERY
|
||||
CHECK_SCRIPT check-data-dir.cmake)
|
||||
|
||||
# FIXME(#26668) This does not work on Windows
|
||||
if (UNIX AND ${RunCMake_GENERATOR} MATCHES "^Ninja")
|
||||
instrument(cmake-command-ninja NO_WARN
|
||||
BUILD_MAKE_PROGRAM
|
||||
|
||||
Reference in New Issue
Block a user