summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake.1.rst10
-rw-r--r--Help/release/dev/cmake-E-multiple-inputs.rst3
-rw-r--r--Source/cmcmd.cxx19
-rw-r--r--Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt0
-rw-r--r--Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt0
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake14
10 files changed, 39 insertions, 11 deletions
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 4cbe976..91af3e3 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -167,7 +167,8 @@ Available commands are:
Change the current working directory and run a command.
``compare_files <file1> <file2>``
- Check if file1 is same as file2.
+ Check if ``<file1>`` is same as ``<file2>``. If files are the same,
+ then returns 0, if not itreturns 1.
``copy <file>... <destination>``
Copy files to ``<destination>`` (either file or directory).
@@ -194,10 +195,11 @@ Available commands are:
Run command in a modified environment.
``environment``
- Display the current environment.
+ Display the current environment variables.
-``make_directory <dir>``
- Create a directory.
+``make_directory <dir>...``
+ Create ``<dir>`` directories. If necessary, create parent
+ directories too.
``md5sum <file>...``
Compute md5sum of files.
diff --git a/Help/release/dev/cmake-E-multiple-inputs.rst b/Help/release/dev/cmake-E-multiple-inputs.rst
index aa52a98..480261d 100644
--- a/Help/release/dev/cmake-E-multiple-inputs.rst
+++ b/Help/release/dev/cmake-E-multiple-inputs.rst
@@ -6,3 +6,6 @@ cmake-E-multiple-inputs
* The :manual:`cmake(1)` ``-E copy_directory`` command-line
tool learned to support copying multiple input directories to a directory.
+
+* The :manual:`cmake(1)` ``-E make_directory`` command-line
+ tool learned to support copying multiple input directories to a directory.
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 6a4234f..fb7b1f5 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -68,7 +68,7 @@ void CMakeCommandUsage(const char* program)
<< " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n"
<< " - run command in a modified environment\n"
<< " environment - display the current environment\n"
- << " make_directory dir - create a directory\n"
+ << " make_directory <dir>... - create parent and <dir> directories\n"
<< " md5sum <file>... - compute md5sum of files\n"
<< " remove [-f] <file>... - remove the file(s), use -f to force "
"it\n"
@@ -447,15 +447,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
#endif
- else if (args[1] == "make_directory" && args.size() == 3)
+ else if (args[1] == "make_directory" && args.size() > 2)
{
- if(!cmSystemTools::MakeDirectory(args[2].c_str()))
+ // If error occurs we want to continue copying next files.
+ bool return_value = 0;
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
{
- std::cerr << "Error making directory \"" << args[2]
- << "\".\n";
- return 1;
+ if(!cmSystemTools::MakeDirectory(args[cc].c_str()))
+ {
+ std::cerr << "Error creating directory \""
+ << args[cc] << "\".\n";
+ return_value = 1;
+ }
}
- return 0;
+ return return_value;
}
else if (args[1] == "remove_directory" && args.size() == 3)
diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt
diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt
new file mode 100644
index 0000000..08a9428
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt
@@ -0,0 +1 @@
+^Error creating directory .*file_for_test.txt\".$
diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 57036ba..5e2200f 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -140,6 +140,20 @@ unset(in)
unset(out)
unset(outfile)
+set(out ${RunCMake_BINARY_DIR}/make_directory_output)
+set(outfile ${out}/file_for_test.txt)
+file(REMOVE_RECURSE "${out}")
+file(MAKE_DIRECTORY ${out})
+file(WRITE ${outfile} "")
+run_cmake_command(E_make_directory-three-directories
+ ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${out}/d2)
+run_cmake_command(E_make_directory-directory-with-parent
+ ${CMAKE_COMMAND} -E make_directory ${out}/parent/child)
+run_cmake_command(E_make_directory-three-directories-and-file
+ ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile})
+unset(out)
+unset(outfile)
+
run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env)
run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1)