code review changes and fixes
This commit is contained in:
23
cmake/CopyResources.cmake
Normal file
23
cmake/CopyResources.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
function(CopyResources TARGET FROM EXTENSIONS)
|
||||
file(GLOB RESOURCES "${FROM}/*")
|
||||
set(RESOURCES_TO_COPY "")
|
||||
|
||||
if (${EXTENSIONS} STREQUAL "*")
|
||||
set(RESOURCES_TO_COPY ${RESOURCES})
|
||||
else()
|
||||
foreach(RESOURCE ${RESOURCES})
|
||||
get_filename_component(EXT "${RESOURCE}" EXT)
|
||||
list(FIND EXTENSIONS ${EXT} EXT_FOUND)
|
||||
if(NOT EXT_FOUND EQUAL -1)
|
||||
list(APPEND RESOURCES_TO_COPY "${RESOURCE}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach(RESOURCE ${RESOURCES_TO_COPY})
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${RESOURCE} $<TARGET_FILE_DIR:${TARGET}>
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user