cmMakeDirectoryCommand.cxx 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmMakeDirectoryCommand.h"
  11. // cmMakeDirectoryCommand
  12. bool cmMakeDirectoryCommand
  13. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  14. {
  15. if(args.size() != 1 )
  16. {
  17. this->SetError("called with incorrect number of arguments");
  18. return false;
  19. }
  20. if ( !this->Makefile->CanIWriteThisFile(args[0].c_str()) )
  21. {
  22. std::string e = "attempted to create a directory: " + args[0]
  23. + " into a source directory.";
  24. this->SetError(e.c_str());
  25. cmSystemTools::SetFatalErrorOccured();
  26. return false;
  27. }
  28. cmSystemTools::MakeDirectory(args[0].c_str());
  29. return true;
  30. }