cmMakeDirectoryCommand.cxx 812 B

123456789101112131415161718192021222324
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmMakeDirectoryCommand.h"
  4. #include "cmSystemTools.h"
  5. // cmMakeDirectoryCommand
  6. bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args,
  7. cmExecutionStatus&)
  8. {
  9. if (args.size() != 1) {
  10. this->SetError("called with incorrect number of arguments");
  11. return false;
  12. }
  13. if (!this->Makefile->CanIWriteThisFile(args[0].c_str())) {
  14. std::string e = "attempted to create a directory: " + args[0] +
  15. " into a source directory.";
  16. this->SetError(e);
  17. cmSystemTools::SetFatalErrorOccured();
  18. return false;
  19. }
  20. cmSystemTools::MakeDirectory(args[0].c_str());
  21. return true;
  22. }