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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Olivier Gomez
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#generating-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)

Best regards,
Olivier Gomez



--
Sent from: http://cmake.3232098.n2.nabble.com/
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Remove a custom command added with add_custom_command(<target> POST_BUILD ...)

CMake mailing list
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
Reply | Threaded
Open this post in threaded view
|

Re: Remove a custom command added with add_custom_command(<target> POST_BUILD ...)

Olivier Gomez
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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Remove a custom command added with add_custom_command(<target> POST_BUILD ...)

Marc CHEVRIER
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 <[hidden email]>, 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 <[hidden email]> 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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Remove a custom command added with add_custom_command(<target> POST_BUILD ...)

Olivier Gomez
That could work too but as the SDK is a single cmake file that rely on nothing else, I can make a copy of it in my repo, remove the add_custom_command() call and use that local version until the patch is done.
It won't force me to change the environment on every computer.

But I'll keep that idea for other cases ! Thanks.

Olivier

Le mer. 6 mars 2019 à 08:38, Marc CHEVRIER <[hidden email]> a écrit :
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 <[hidden email]>, 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 <[hidden email]> 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

--

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