cmMakeDirectoryCommand.cxx 846 B

123456789101112131415161718192021222324252627
  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 "cmMakefile.h"
  5. #include "cmSystemTools.h"
  6. class cmExecutionStatus;
  7. // cmMakeDirectoryCommand
  8. bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args,
  9. cmExecutionStatus&)
  10. {
  11. if (args.size() != 1) {
  12. this->SetError("called with incorrect number of arguments");
  13. return false;
  14. }
  15. if (!this->Makefile->CanIWriteThisFile(args[0])) {
  16. std::string e = "attempted to create a directory: " + args[0] +
  17. " into a source directory.";
  18. this->SetError(e);
  19. cmSystemTools::SetFatalErrorOccured();
  20. return false;
  21. }
  22. cmSystemTools::MakeDirectory(args[0]);
  23. return true;
  24. }