[CMake] dependency problem + POST_BUILD events

Sergei Riaguzov riaguzov at gmail.com
Wed Jul 25 06:00:37 EDT 2007


Hi!

I have a problem with POST_BUILD events. I have a target:


add_library(blabla MODULE ${HDRS} ${SRCS}

smth like that. Then lately I add a POST_BUILD event:

add_custom_command(TARGET blabla POST_BUILD
    COMMAND ${7ZIP_BIN}/7z.exe a -tzip blablablabla
)

so now I create a NMakefile and a Visual Studio solution and everything
works well except that my real target is not creating a DLL with
add_library, but creating DLL _and_ packing it lately to some zip file. Now
that zip file goes to somewhere and it is that zip file which is the real
goal of the build process.

So the problem is: when I delete this real target (this zip file) it won't
be packed by NMake after calling NMake on generated NMakefile. NMake will
see that the DLL is there so it won't call my blabla target "add_library"
target. So I won't get the POST_BUILD event and nothing will be zipped. Only
when I delete the DLL file I will get add_library target executed with it
POST_BUILD event resulting in creating my goal zip.

Can this be solved somehow? What I want is my POST_BUILD event zipping my
DLL be called in case the DLL produced by add_library exists. Is this
possible? The only thing which I can think of is to add another target with
the same zipping command and add it as a dependancy to my "blabla", so that
my zipping target will be called before creating DLL and after creating DLL,
so will be called anyway. Is there a better solution?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070725/61108680/attachment.htm


More information about the CMake mailing list