mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
The `install_files`, `install_programs`, `install_targets`, `make_directory`, `remove`, `subdirs` and `write_file` commands have been deprecated since CMake 3.0. Tweak them to emit deprecation diagnostics. Note that the `exec_program` command does not need a diagnostic as it is disallowed under CMP0153.
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#include "cmMakeDirectoryCommand.h"
|
|
|
|
#include "cmDiagnostics.h"
|
|
#include "cmExecutionStatus.h"
|
|
#include "cmMakefile.h"
|
|
#include "cmSystemTools.h"
|
|
|
|
// cmMakeDirectoryCommand
|
|
bool cmMakeDirectoryCommand(std::vector<std::string> const& args,
|
|
cmExecutionStatus& status)
|
|
{
|
|
cmMakefile& mf = status.GetMakefile();
|
|
|
|
mf.IssueDiagnostic(cmDiagnostics::CMD_DEPRECATED,
|
|
"The 'make_directory' command has been superseded. "
|
|
"Use 'file(MAKE_DIRECTORY)' instead.");
|
|
|
|
if (args.size() != 1) {
|
|
status.SetError("called with incorrect number of arguments");
|
|
return false;
|
|
}
|
|
if (!mf.CanIWriteThisFile(args[0])) {
|
|
std::string e = "attempted to create a directory: " + args[0] +
|
|
" into a source directory.";
|
|
status.SetError(e);
|
|
cmSystemTools::SetFatalErrorOccurred();
|
|
return false;
|
|
}
|
|
cmSystemTools::MakeDirectory(args[0]);
|
|
return true;
|
|
}
|