/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 "cmDiagnostics.h" |
6 | | #include "cmExecutionStatus.h" |
7 | | #include "cmMakefile.h" |
8 | | #include "cmSystemTools.h" |
9 | | |
10 | | // cmMakeDirectoryCommand |
11 | | bool cmMakeDirectoryCommand(std::vector<std::string> const& args, |
12 | | cmExecutionStatus& status) |
13 | 0 | { |
14 | 0 | cmMakefile& mf = status.GetMakefile(); |
15 | |
|
16 | 0 | mf.IssueDiagnostic(cmDiagnostics::CMD_DEPRECATED, |
17 | 0 | "The 'make_directory' command has been superseded. " |
18 | 0 | "Use 'file(MAKE_DIRECTORY)' instead."); |
19 | |
|
20 | 0 | if (args.size() != 1) { |
21 | 0 | status.SetError("called with incorrect number of arguments"); |
22 | 0 | return false; |
23 | 0 | } |
24 | 0 | if (!mf.CanIWriteThisFile(args[0])) { |
25 | 0 | std::string e = "attempted to create a directory: " + args[0] + |
26 | 0 | " into a source directory."; |
27 | 0 | status.SetError(e); |
28 | 0 | cmSystemTools::SetFatalErrorOccurred(); |
29 | 0 | return false; |
30 | 0 | } |
31 | 0 | cmSystemTools::MakeDirectory(args[0]); |
32 | 0 | return true; |
33 | 0 | } |