/src/CMake/Source/cmMakeDirectoryCommand.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #include "cmMakeDirectoryCommand.h" |
4 | | |
5 | | #include "cmExecutionStatus.h" |
6 | | #include "cmMakefile.h" |
7 | | #include "cmSystemTools.h" |
8 | | |
9 | | // cmMakeDirectoryCommand |
10 | | bool cmMakeDirectoryCommand(std::vector<std::string> const& args, |
11 | | cmExecutionStatus& status) |
12 | 0 | { |
13 | 0 | if (args.size() != 1) { |
14 | 0 | status.SetError("called with incorrect number of arguments"); |
15 | 0 | return false; |
16 | 0 | } |
17 | 0 | if (!status.GetMakefile().CanIWriteThisFile(args[0])) { |
18 | 0 | std::string e = "attempted to create a directory: " + args[0] + |
19 | 0 | " into a source directory."; |
20 | 0 | status.SetError(e); |
21 | 0 | cmSystemTools::SetFatalErrorOccurred(); |
22 | 0 | return false; |
23 | 0 | } |
24 | 0 | cmSystemTools::MakeDirectory(args[0]); |
25 | 0 | return true; |
26 | 0 | } |