diff --git a/Help/manual/cmake-instrumentation.7.rst b/Help/manual/cmake-instrumentation.7.rst index 64808323e7..4f6df4ea8e 100644 --- a/Help/manual/cmake-instrumentation.7.rst +++ b/Help/manual/cmake-instrumentation.7.rst @@ -196,6 +196,9 @@ key is required, but all other fields are optional. * ``postInstall`` * ``postTest`` + ``preBuild`` and ``postBuild`` are not supported with the + :generator:`MSYS Makefiles` generator. + ``options`` A list of strings used to enable certain optional behavior, including the collection of certain additional data. Elements in this list should be one of diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 8971eafc51..7273c2e842 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -691,7 +691,9 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables( #ifndef CMAKE_BOOTSTRAP if (this->GetCMakeInstance() ->GetInstrumentation() - ->HasPreOrPostBuildHook()) { + ->HasPreOrPostBuildHook() && + // FIXME(#27079): This does not work for MSYS Makefiles. + this->GlobalGenerator->GetName() != "MSYS Makefiles") { std::string ctestShellCommand = getShellCommand(cmSystemTools::GetCTestCommand()); makefileStream << "# The CTest executable.\n" @@ -850,8 +852,11 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom( std::vector no_depends; commands.push_back(std::move(runRule)); #ifndef CMAKE_BOOTSTRAP - addInstrumentationCommand(this->GetCMakeInstance()->GetInstrumentation(), - commands); + // FIXME(#27079): This does not work for MSYS Makefiles. + if (this->GlobalGenerator->GetName() != "MSYS Makefiles") { + addInstrumentationCommand(this->GetCMakeInstance()->GetInstrumentation(), + commands); + } #endif if (!this->IsRootMakefile()) { this->CreateCDCommand(commands, this->GetBinaryDirectory(), @@ -1856,8 +1861,11 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( " 1"); commands.push_back(std::move(runRule)); #ifndef CMAKE_BOOTSTRAP - addInstrumentationCommand(this->GetCMakeInstance()->GetInstrumentation(), - commands); + // FIXME(#27079): This does not work for MSYS Makefiles. + if (this->GlobalGenerator->GetName() != "MSYS Makefiles") { + addInstrumentationCommand( + this->GetCMakeInstance()->GetInstrumentation(), commands); + } #endif } this->CreateCDCommand(commands, this->GetBinaryDirectory(), diff --git a/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake b/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake index 40d6809cee..4410e35082 100644 --- a/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake +++ b/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake @@ -129,7 +129,10 @@ instrument(cmake-command-resets-generated NO_WARN CHECK_SCRIPT check-data-dir.cmake ) -if(RunCMake_GENERATOR STREQUAL "NMake Makefiles") +if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles") + # FIXME(#27079): This does not work for MSYS Makefiles. + set(Skip_BUILD_MAKE_PROGRAM_Case 1) +elseif(RunCMake_GENERATOR STREQUAL "NMake Makefiles") execute_process( COMMAND "${RunCMake_MAKE_PROGRAM}" -? OUTPUT_VARIABLE nmake_out