[CMake] ninja generator and add_custom_target bug

Petr Kmoch petr.kmoch at gmail.com
Fri Oct 3 05:27:55 EDT 2014


Hi Russell,

you might want to add VERBATIM to the custom target, so that command-line
arguments are escaped properly:

ADD_CUSTOM_TARGET(uninstall
  COMMAND echo "\nRemoving installed files:"
  COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt | xargs rm
-fv
  VERBATIM
)

See the docs:
http://www.cmake.org/cmake/help/v3.0/command/add_custom_target.html

I don't know whether it helps, but it might.

Petr


On Thu, Oct 2, 2014 at 7:54 PM, Russell L. Carter <rcarter at esturion.net>
wrote:

> Hi,
>
> With this cmake code:
>
> ADD_CUSTOM_TARGET(uninstall
>   COMMAND echo "\nRemoving installed files:"
>   COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt | xargs
> rm -fv
>   )
>
> (sorry about the wrapping...)
>
> the ninja generator fails with:
>
> ninja: error: build.ninja:90: expected '=', got lexing error
>
> which turns out to be (again, the wrapping makes this hard
> to see):
>
> build CMakeFiles/uninstall: CUSTOM_COMMAND
>   COMMAND = cd /usr/home/rcarter/projects/nail/core/build/c++.Debug &&
> echo
> Removing\ installed\ files: && cat
> /usr/home/rcarter/projects/nail/core/build/c++.Debug/install_manifest.txt
> | xargs rm -fv
>
> The problem seems to be that the echo'd text starting with
> "Removing" begins after a newline.
>
> The cmake code works fine with the gmake generator.
>
> Best regards,
> Russell
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141003/29b7761d/attachment.html>


More information about the CMake mailing list