开发者

cmake move directory

I was wondering if there was a way (such as a commad) to move a directory filled with, say, image files, to the build directory using cmake 2.开发者_高级运维8.

Thanks in advance!


The file() command can do what you want.

From the cmake manual:

The file() command also provides COPY and INSTALL signatures:

file(<COPY|INSTALL> files... DESTINATION <dir>
   [FILE_PERMISSIONS permissions...]
   [DIRECTORY_PERMISSIONS permissions...]
   [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]
   [FILES_MATCHING]
   [[PATTERN <pattern> | REGEX <regex>]
   [EXCLUDE] [PERMISSIONS permissions...]] [...])

The COPY signature copies files, directories, and symlinks to a destination fold Relative input paths are evaluated with respect to the current source directory, and a relative destination is evaluated with respect to the current build directory. Copying preserves input file timestamps, and optimizes out a file if it exists at the destination with the same timestamp. Copying preserves input permissions unless explicit permissions or NO_SOURCE_PERMISSIONS are given (default is USE_SOURCE_PERMISSIONS). See the install(DIRECTORY) command for documentation of permissions, PATTERN, REGEX, and EXCLUDE options.

So you would have something like (tested):

file(COPY ${YOUR_SRC_IMAGE_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/YourPreferedDestination)

To move, you can use the RENAME form:

file(RENAME ${YOUR_SRC_IMAGE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/PreferedDestination)

But I am not sure that you would want that, because the source will not be available anymore to reproduce the build sequence, hence my attempt to answer with the copy command above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜