Custom command with unknown inputs and dependencies

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Custom command with unknown inputs and dependencies

Hey guys,

I have a problem with my custom command.
The target is to generate an archive of different shared libraries.

The current code:

file(GLOB Modules "Obj/lib/*.dll")
foreach(Module ${Modules})
        set(ModulesGZip "${ModuleGZip} ${Module}")
endforeach(Module ${Modules})

add_custom_command(OUTPUT Obj/Modules.gz
                               COMMAND "gzip -f -9 -c${ModulesGZip} > Obj/Modules.gz"
                               DEPENDS Library Memory
                               COMMENT "compress all generated modules")

The first problem is, that the custom command gets an error.
The shell can not find the file (I do not know which one).
If I use the command directly on the shell, everything works fine.

The second problem is, that I do not know all dependencies.
How can I generate the dependencies dynamically?

Thank you.