|
|
|
@ -31,10 +31,33 @@ function(copy TARGET)
|
|
|
|
|
foreach(index RANGE ${len})
|
|
|
|
|
list(GET copy_lib_SRCS ${index} src)
|
|
|
|
|
list(GET copy_lib_DSTS ${index} dst)
|
|
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
# windows cmd shell will not expand wildcard automatically.
|
|
|
|
|
# below expand the files,libs and copy them by rules.
|
|
|
|
|
file(GLOB header_files ${src} "*.h")
|
|
|
|
|
file(GLOB static_lib_files ${src} "*.lib")
|
|
|
|
|
file(GLOB dll_lib_files ${src} "*.dll")
|
|
|
|
|
set(src_files ${header_files} ${static_lib_files} ${dll_lib_files})
|
|
|
|
|
|
|
|
|
|
if (NOT "${src_files}" STREQUAL "")
|
|
|
|
|
list(REMOVE_DUPLICATES src_files)
|
|
|
|
|
endif()
|
|
|
|
|
#string(REPLACE ";" " " src_files ${src_files})
|
|
|
|
|
add_custom_command(TARGET ${TARGET} PRE_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${dst}"
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}"
|
|
|
|
|
)
|
|
|
|
|
foreach(src_file ${src_files})
|
|
|
|
|
add_custom_command(TARGET ${TARGET} PRE_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${src_file}" "${dst}"
|
|
|
|
|
COMMENT "copying ${src_file} -> ${dst}")
|
|
|
|
|
endforeach()
|
|
|
|
|
else() # not windows
|
|
|
|
|
add_custom_command(TARGET ${TARGET} PRE_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${dst}"
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${src_files}" "${dst}"
|
|
|
|
|
COMMENT "copying ${src} -> ${dst}")
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
endforeach()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|