View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015561CMakeCMakepublic2015-05-08 09:002015-11-02 09:15
ReporterWojciech Mamrak 
Assigned To 
PriorityhighSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformPCOSWindowsOS Version7.1
Product VersionCMake 3.2.2 
Target VersionFixed in Version 
Summary0015561: file COPY FILES_MATCHING PATTERN copies folders' structure
DescriptionThis command:

file(COPY "src/" DESTINATION "dst" FILES_MATCHING PATTERN "*.bat")

copies not only all *.bat files from src to dst, but also folders' structure.
For example, if src is:
src:
 - foo.bat
 - bar.bat
 - images [folder]
   - foo.png
   - bar [folder]

then after calling the command, dst is:
dst:
 - foo.bat
 - bar.bat
 - images [folder]
   - bar [folder]
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0038731)
Wojciech Mamrak (reporter)
2015-05-08 09:02

Forgot to mention, that file extension is irrelevant.
(0038732)
Brad King (manager)
2015-05-08 09:33

This is expected. Your "src/" source says to copy the directory, and copying directories preserves their structure. The FILES_MATCHING option just filters the set of files within that structure.

I've updated the documentation:

 Help: Clarify file(COPY) directory semantics
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f39d26ca [^]

You can use file(GLOB_RECURSE) to collect files from a directory structure and then specify the results as the list of files to file(COPY).
(0038736)
Wojciech Mamrak (reporter)
2015-05-08 10:26

I expected this is not a bug but a feature, but the documentation did not make it clear. Now it is OK.
Yes, this is how I solved this.

regards
(0039806)
Robert Maynard (manager)
2015-11-02 09:15

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-05-08 09:00 Wojciech Mamrak New Issue
2015-05-08 09:02 Wojciech Mamrak Note Added: 0038731
2015-05-08 09:33 Brad King Note Added: 0038732
2015-05-08 09:33 Brad King Status new => resolved
2015-05-08 09:33 Brad King Resolution open => no change required
2015-05-08 10:26 Wojciech Mamrak Note Added: 0038736
2015-11-02 09:15 Robert Maynard Note Added: 0039806
2015-11-02 09:15 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team