Due to very special needs, I have a static library which I need to "post-process" after it is created. So I have this:
add_library(CANopenNode2 STATIC
...)
add_custom_command(TARGET CANopenNode2 POST_BUILD
COMMAND objcopy --redefine-syms=renames.txt $<TARGET_FILE:CANopenNode2>)
My problem here is that the whole build step does not depend on renames.txt
regular file - if I change it, the library does not get re-archived or re-processed. The add_custom_command(TARGET ... POST_BUILD ...)
signature does not accept any DEPENDS
argument. I've tried some regular tricks with creating a custom command (depending on that file), wrapped in custom target, which is then marked as a dependency for my static library CANopenNode2
, but I most likely did something wrong, as it did not work at all. As I later need this "post-processed" library to be linked to my executable, I would prefer to work with POST_BUILD
somehow, as I guess that using a regular custom command (which can depend on a file) would also be complicated, just in some other aspect, but I'm obviously open to suggestions.
Is there any way I could simply make the whole library depend on this regular file, or is this yet another thing that CMake makes extremely complicated?