I want to have a macro to copy files looking like this:
MACRO(POST_BUILD_COPY src_files dest_path)
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${src_files} ${dest_path})
ENDMACRO(POST_BUILD_COPY src_files dest_path)
This is perfectly fine in most cases. My problem is that src_files can be something like path/to/${CMAKE_CFG_INTDIR}/headers/*.h.
The problems are
cmake -E copy(norcopy_directory) does not seem to be able to handle the wildcardfile(GLOB files ${src_files})resolves to an empty array since it is evaluated at the configuration time and${CMAKE_CFG_INTDIR}is a build time variable (which is for example$(Configuration)for msvc)
Is there a cmake way to tackle this problem that I am missing ? I do not want to rely on external tools (this is what we do right now, and it leads to other issues we want to get rid of)