mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-24 09:09:43 -05:00
ENH: Create file(COPY) command signature
The file(INSTALL) command has long been undocumented and used only to implement install() scripts. We now document it and provide a similar file(COPY) signature which is useful in general-purpose scripts. It provides the capabilities of install(DIRECTORY) and install(FILES) but operates immediately instead of contributing to install scripts.
This commit is contained in:
@@ -188,10 +188,19 @@ FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${outfile}")
|
||||
FILE(RENAME "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h")
|
||||
|
||||
# Test file copy with relative paths
|
||||
FILE(COPY .
|
||||
DESTINATION src
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
|
||||
DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE # test no OWNER_WRITE
|
||||
FILES_MATCHING PATTERN *.cxx # Only copy the main source file
|
||||
REGEX /src$ EXCLUDE # Block recursion for in-source build
|
||||
)
|
||||
|
||||
# Test file glob
|
||||
FILE(GLOB_RECURSE src_files "${CMAKE_CURRENT_SOURCE_DIR}/*")
|
||||
MESSAGE("Files in ${CMAKE_CURRENT_SOURCE_DIR} are ${src_files}")
|
||||
SET(expr "${CMAKE_CURRENT_SOURCE_DIR}/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx")
|
||||
SET(expr "${CMAKE_CURRENT_BINARY_DIR}/src/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx")
|
||||
MESSAGE("Glob expression is [${expr}].")
|
||||
FILE(GLOB src_files "${expr}")
|
||||
MESSAGE("Globbed files [${src_files}].")
|
||||
|
||||
Reference in New Issue
Block a user