MantisBT - CMake
View Issue Details
0015703CMakeCMakepublic2015-08-18 07:252016-05-02 08:30
Bartosz 
 
normalfeaturealways
closedfixed 
allOSX10.10
CMake 3.2.3 
CMake 3.5CMake 3.5 
0015703: "cmake -E copy" support for multiple files
The copy operation is not support wildcart (star "*") when the full path is specified. But it is working correctly with "remove.
"cmake -E remove" is not consistent with "cmake -E copy".

With using cmake shell comamnd you could add star to whole path:
   cmake -E remove /Users/warsaw/cos/*.h

But it is not possible to make similar operation with "-E copy":
   cmake -E copy /Users/warsaw/cos/*.h ..
displays "CMakre Error"

But:
   cmake -E copy *.h ..
or:
   cmake -E copy /Users/warsaw/cos/file.h ..

is working correctly.


1. mkdir /Users/warsaw/cos/
2. cd /Users/warsaw/cos/
3. touch file.h
4. cmake -E copy /Users/warsaw/cos/*.h ..

displays "CMakre Error"



Working correctly:
   cmake -E copy *.h ..
   cmake -E copy /Users/warsaw/cos/file.h ..
No tags attached.
related to 0015870closed Kitware Robot "cmake -E copy" command do not display error if source is directory 
Issue History
2015-08-18 07:25BartoszNew Issue
2015-08-18 09:20Brad KingNote Added: 0039296
2015-08-18 09:20Brad KingSeverityminor => feature
2015-08-18 09:20Brad KingSummary"cmake -E copy" is not working with wildcart, when full path is specified => "cmake -E copy" support for multiple files
2015-08-18 15:02BartoszNote Added: 0039300
2015-08-18 15:16Brad KingNote Added: 0039301
2015-12-02 15:53BartoszNote Added: 0039939
2015-12-03 08:41Brad KingRelationship addedrelated to 0015870
2015-12-04 10:35Brad KingNote Added: 0039953
2015-12-04 10:36Brad KingNote Added: 0039954
2015-12-04 10:37Brad KingStatusnew => resolved
2015-12-04 10:37Brad KingResolutionopen => fixed
2015-12-04 10:37Brad KingFixed in Version => CMake 3.5
2015-12-04 10:37Brad KingTarget Version => CMake 3.5
2016-05-02 08:30Robert MaynardNote Added: 0040978
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0039296)
Brad King   
2015-08-18 09:20   
According to the documentation:

 http://www.cmake.org/cmake/help/v3.3/manual/cmake.1.html#command-line-tool-mode [^]

The two relevant "cmake -E" signatures are:

 copy <file> <destination>

and:

 remove [-f] [<file>...]

The "remove" signature documents support for multiple files but "copy" does not. In your example the wildcard is expanded by the shell so CMake sees many arguments.
(0039300)
Bartosz   
2015-08-18 15:02   
Thanks Brad.

If wildcard is expanded by shell, then why command:
   cmake -E copy *.h ..

is working correctly.
Is should also not working, as it will be expanded by shell into multiple arguments.
(0039301)
Brad King   
2015-08-18 15:16   
Re 0015703:0039300: If there is only one .h file then the shell wildcard will expand to just that one value as if it had been spelled out explicitly.
(0039939)
Bartosz   
2015-12-02 15:53   
Additional notes:

At Source/cmcmd.cxx there is implementation of "cmake -E" commands.
In this case the wildcard is expected to be expanded by the shell,
so what we really want is for the copy command to support multiple
inputs and a single (directory) output. The semantics should match
the UNIX "cp" command as much as possible.
(0039953)
Brad King   
2015-12-04 10:35   
Corresponding mailing list thread:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/15139/focus=15154 [^]
(0039954)
Brad King   
2015-12-04 10:36   
Patches from mailing list applied:

 cmake: Improve '-E' help message formatting
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0be5020b [^]

 cmake: Teach -E copy[_if_different] to support multiple files
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=384ae551 [^]
(0040978)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.