diff options
author | Christian Fetzer <fetzer.ch@gmail.com> | 2016-09-06 22:16:01 +0200 |
---|---|---|
committer | Christian Fetzer <fetzer.ch@gmail.com> | 2016-09-06 22:20:49 +0200 |
commit | f6b4b59fc19eefe764eae17da209d8edb5131d68 (patch) | |
tree | 3b5b1b48d81ea2b262758166d680da9669659785 /project | |
parent | 75510032478ac92c8c3df990ef678b53a4721eb9 (diff) |
[cmake] Fix globbing of single files on export
GLOB_RECURSE when called with a file name will list all files with the
given name in all subdirectories. This is unintuitive for files
specified in installdata. Here if a full file name is specified only
that single file should be mirrored/installed.
Example: tools/depends/target/openssl/cacert.pem
Current behavior, mirrors:
- tools/depends/target/openssl/cacert.pem
- tools/depends/target/openssl/iphoneos8.1_armv7-target/apps/demoCA/cacert.pem
- tools/depends/target/openssl/iphoneos8.1_armv7-target/demos/cms/cacert.pem
- tools/depends/target/openssl/iphoneos8.1_armv7-target/demos/smime/cacert.pem
Intended behavior, mirror only:
- tools/depends/target/openssl/cacert.pem
Diffstat (limited to 'project')
-rw-r--r-- | project/cmake/scripts/common/Macros.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/project/cmake/scripts/common/Macros.cmake b/project/cmake/scripts/common/Macros.cmake index 4f2e1d6122..8c6872b8ac 100644 --- a/project/cmake/scripts/common/Macros.cmake +++ b/project/cmake/scripts/common/Macros.cmake @@ -259,7 +259,15 @@ function(copy_files_from_filelist_to_buildtree pattern) else() list(GET dir -1 dest) endif() - file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${src}) + + # If the full path to an existing file is specified then add that single file. + # Don't recursively add all files with the given name. + if(EXISTS ${CORE_SOURCE_DIR}/${src} AND NOT IS_DIRECTORY ${CORE_SOURCE_DIR}/${src}) + set(files ${src}) + else() + file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${src}) + endif() + foreach(file ${files}) if(arg_NO_INSTALL) copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} DIRECTORY ${dest} NO_INSTALL) |