cmMakeDirectoryCommand.cxx 839 B

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