MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteMakeVariables

Method WriteMakeVariables

Source/cmLocalUnixMakefileGenerator3.cxx:661–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
662 std::ostream& makefileStream)
663{
664 this->WriteDivider(makefileStream);
665 makefileStream << "# Set environment variables for the build.\n"
666 "\n";
667 cmGlobalUnixMakefileGenerator3* gg =
668 static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
669 if (gg->DefineWindowsNULL) {
670 makefileStream << "!IF \"$(OS)\" == \"Windows_NT\"\n"
671 "NULL=\n"
672 "!ELSE\n"
673 "NULL=nul\n"
674 "!ENDIF\n";
675 }
676 if (this->IsWindowsShell()) {
677 makefileStream << "SHELL = cmd.exe\n"
678 "\n";
679 } else {
680#if !defined(__VMS)
681 makefileStream << "# The shell in which to execute make rules.\n"
682 "SHELL = /bin/sh\n"
683 "\n";
684#endif
685 }
686
687 auto getShellCommand = [this](std::string command) -> std::string {
688 std::string shellCommand = this->MaybeConvertWatcomShellCommand(command);
689 return shellCommand.empty()
690 ? this->ConvertToOutputFormat(command, cmOutputConverter::SHELL)
691 : shellCommand;
692 };
693
694 std::string cmakeShellCommand =
695 getShellCommand(cmSystemTools::GetCMakeCommand());
696
697 makefileStream << "# The CMake executable.\n"
698 "CMAKE_COMMAND = "
699 << cmakeShellCommand << "\n";
700
701#ifndef CMAKE_BOOTSTRAP
702 if (this->GetCMakeInstance()->GetInstrumentation()->HasQuery() &&
703 // FIXME(#27079): This does not work for MSYS Makefiles.
704 this->GlobalGenerator->GetName() != "MSYS Makefiles") {
705 std::string ctestShellCommand =
706 getShellCommand(cmSystemTools::GetCTestCommand());
707 makefileStream << "# The CTest executable.\n"
708 "CTEST_COMMAND = "
709 << ctestShellCommand << "\n";
710 }
711#endif
712
713 makefileStream
714 << "\n"
715 "# The command to remove a file.\n"
716 "RM = "
717 << cmakeShellCommand
718 << " -E rm -f\n"

Callers 1

Calls 9

WriteDividerMethod · 0.95
IsWindowsShellMethod · 0.80
HasQueryMethod · 0.80
GetInstrumentationMethod · 0.80
emptyMethod · 0.45
ConvertToOutputFormatMethod · 0.45
GetCMakeInstanceMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected