diff options
author | fuzzard <fuzzard@kodi.tv> | 2023-10-01 16:33:36 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2023-10-26 14:04:37 +1000 |
commit | 4b26f46c4f106943bdcf8ebcbf1bb285b2a02ee9 (patch) | |
tree | 7f6ca972575ecc304c5856c09c094ab9d26b4b35 /cmake | |
parent | 8c91f3ea7d158e401a7e81f92dc20d170ccf29fc (diff) |
[cmake] enable copy_file_to_buildtree to handle files created at build time
This allows files in DEPENDS_PATH to be handled at build time to install to
the target build tree. This is required when for example a shared lib is built at build time
and needs to be bundled. The existing globbing wont find the lib at generation time,
therefore it doesnt get bundled.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/scripts/common/Macros.cmake | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake index 5e88639cb5..cbd55b82be 100644 --- a/cmake/scripts/common/Macros.cmake +++ b/cmake/scripts/common/Macros.cmake @@ -248,8 +248,18 @@ function(copy_file_to_buildtree file) endif() if(${CORE_SYSTEM_NAME} MATCHES "windows") - file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake - "file(COPY \"${file}\" DESTINATION \"\$\{BUNDLEDIR\}/${outdir}\")\n" ) + # if DEPENDS_PATH in fille + if(${file} MATCHES ${DEPENDS_PATH}) + file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake +"file(GLOB filenames ${file}) +foreach(filename \$\{filenames\}) + file(COPY \"\$\{filename\}\" DESTINATION \"\$\{BUNDLEDIR\}/${outdir}\") +endforeach()\n" + ) + else() + file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake + "file(COPY \"${file}\" DESTINATION \"\$\{BUNDLEDIR\}/${outdir}\")\n" ) + endif() else() if(NOT file STREQUAL ${CMAKE_BINARY_DIR}/${outfile}) if(NOT IS_SYMLINK "${file}") @@ -319,11 +329,16 @@ function(copy_files_from_filelist_to_buildtree pattern) list(GET dir -1 dest) endif() - # 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 ${CMAKE_SOURCE_DIR}/${src} AND (NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${src} OR DIR_OPTION)) + if((${CMAKE_SOURCE_DIR}/${src} MATCHES ${DEPENDS_PATH}) OR + (EXISTS ${CMAKE_SOURCE_DIR}/${src} AND (NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${src} OR DIR_OPTION))) + # If the path is in DEPENDS_PATH, pass through as is. This will be handled in a build time + # glob of the location. This insures any dependencies built at build time can be bundled if + # required. + # OR 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. set(files ${src}) else() + # Static path contents, so we can just glob at generation time file(GLOB_RECURSE files RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/${src}) endif() |