file: Add a COPY command working at cmake generation time
I want to copy files on a destination path and on condition which depend on the build type for a multi config generator. Unfortunately the command file(copy... does not work with generator expression.
I wanted to use the file(generate... with the condition parameter, but unfortunately this function does not work on binary file, it copies only part of them (a 5 Mb binary file becomes silently a 3 Kb file which is more or less the beginning of the original file). I guess the function only work for text file, not for binary file. Maybe there is something to make more explicit here (documentation, error case when copying, ...).
Is there another way to achieve what I want without executing sub-process command to copy file at the build time ? Would it makes sense to have a version of the file(copy function at the generation time which supports generator expression and a condition parameter ?