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