[CMake] Remove a custom command added with add_custom_command(<target> POST_BUILD ...)

Marc CHEVRIER marc.chevrier at gmail.com
Wed Mar 6 02:36:35 EST 2019


In the meantime if this POST_BUILD command calls a specific tool you can create a no-op shell script with the same name and put its location in the PATH variable.
Le 6 mars 2019 à 07:41 +0100, Olivier Gomez <oliviergomez.og at gmail.com>, a écrit :
> Thank you for your suggestions.
> I think the best option is a patch but it will take some time ... I guess I will have to find a workaround in the meantime !
>
> Anyway, thanks again !
> Olivier
>
> > Le mar. 5 mars 2019 à 18:58, Kyle Edwards <kyle.edwards at kitware.com> a écrit :
> > > On Tue, 2019-03-05 at 10:01 -0700, Olivier Gomez wrote:
> > > > Hello,
> > > >
> > > > I have been searching for a way to remove a custom command
> > > > (POST_BUILD
> > > > event) from a target in CMake but, so far, I've found nothing.
> > > >
> > > > I tried to add another custom command to override the first one but
> > > > it seems
> > > > to append a second command.
> > > > I tough that could work because of the first signature of
> > > > add_custom_command() that can take an optional argument named APPEND.
> > > > https://cmake.org/cmake/help/v3.4/command/add_custom_command.html#gen
> > > > erating-files
> > > > Then, I looked for a target property that contains the POST_BUILD
> > > > custom
> > > > command (to erase it) but, again, I found nothing related (I listed
> > > > every
> > > > property using the "cmake --help-property-list" command).
> > > >
> > > >
> > > > The context is that I configure a project using a "CMake SDK" from a
> > > > third
> > > > party library (custom functions that create and configure a shared
> > > > library
> > > > target basically).
> > > > Until recently, I used to create those target by myself using
> > > > standard CMake
> > > > command.
> > > > But now I switched to the "SDK" because it does a lot of specific
> > > > thing
> > > > depending on the platform (and between the current version of the SDK
> > > > and
> > > > all the legacy version) and I don't want to rewrite everything.
> > > >
> > > > Specifically, this SDK add a custom command as a POST_BUILD event to
> > > > run a
> > > > tool that perform a signature on the produced library. As it is a
> > > > proprietary tool that requires a valid licence to work, I want to
> > > > remove
> > > > that command in order to have a successful build even if i don't
> > > > currently
> > > > have a licence on my machine.
> > > >
> > > > So ... is there some way to remove a custom command in CMake ? (or
> > > > ignore
> > > > failed command maybe)
> > >
> > > CMake doesn't have a way to remove a custom command from a target. Your
> > > best bet would be to either:
> > >
> > > 1) Fork the SDK for your project to remove the proprietary tool, or
> > > 2) Submit a patch upstream to add an option to disable the proprietary
> > > tool.
> > >
> > > Kyle
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190306/c877f286/attachment-0001.html>


More information about the CMake mailing list