[CMake] POST_BUILD & ALL_BUILD
Michael Hertling
mhertling at online.de
Tue Mar 6 03:55:56 EST 2012
On 03/06/2012 02:34 AM, Christopher Piekarski wrote:
> Hello All,
>
> I am trying to attach a custom POST_BUILD command to the ALL_BUILD target.
> I've tried adding the following at the bottom of my root CMakeLists.txt
> file but the Post Event never shows up in Visual Studio. I have been able
> to get it to work for sub projects, just not ALL_BUILD. Has anyone gotten
> this to work?
>
> add_custom_command(TARGET ALL_BUILD
> POST_BUILD
> COMMAND "python27.exe brand.py"
> COMMENT "Branding VS debug build"
> )
AFAIK, that's not possible ATM, see also [1].
Instead, you could use a custom target
ADD_CUSTOM_TARGET(brand ALL
COMMAND python27.exe brand.py
COMMENT "Branding VS debug build"
)
ADD_DEPENDENCIES(brand target<1> ... target<n>)
and list your project's targets as prerequisites in order to ensure
that "brand" is built last. For convenience, you might consider to
provide wrappers for ADD_LIBRARY() and ADD_EXECUTABLE() which add
the respective target to a global property, and use the latter's
value for the above-noted ADD_DEPENDENCIES() at the end of your
top-level CMakeLists.txt.
Regards,
Michael
[1] http://public.kitware.com/Bug/view.php?id=8438
More information about the CMake
mailing list