[CMake] ninja generator and add_custom_target bug
Russell L. Carter
rcarter at esturion.net
Sat Oct 4 18:22:48 EDT 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi David and Petr,
A bit of experimenting and indeed it was that "\n" causing the
problem. Escaping it ("\\n") produces an "n" prefix when building
with make, so after further experiments I decided I could lose the
"\n" entirely. KISS principle.
Thanks!
Russell
On 10/03/14 02:54, David Cole wrote:
> Or, if echo is the thing that's supposed to see the "\n", escape
> the backslash and use "\\n" in CMake so CMake puts the literal "\n"
> in the generated file instead of a newline.
>
> HTH, D
>
> On Fri, Oct 3, 2014 at 5:27 AM, Petr Kmoch <petr.kmoch at gmail.com>
> wrote:
>> 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
>>
>>
>>
>> --
>>
>> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBAgAGBQJUMHM4AAoJEHsx8WYuhXpLp1YP/iEotr4nVogUIMVfrbbwCAk3
nQWWydR7bxuD4vb/ai1JhsrndfXmdYo1Zfjrzns3MXwgalNRvhZR13U47Qohkgo5
QdtaXacMahoW0hEY7p/vcxBQsLK7bcqf1GA4W3JPiuB3aoqV/IOqkzwWhYOG54Ld
bXCCP0Th3qoz7hzDlr7V7jeYHQDA8a4lVumu0Oee8pNOiItggjwOERZU5a+UtqyX
+KKAyEvrw9pi64bXGq76g1S664JlN9BeIKVfqFhsf6J32a5ufgVKSXuHyIa8F9Eu
e/W7xqmtSv6Yq5NyFSrVqoTH9vX4P9JKHHnZ8uwByzbscZAq81jtWkFwPiTDoGaO
ybYeFvSOUMnbRrwRelwphNR7iaNzpYMJ+iRPGJYJjaWhmHUKPnMQWoZxiguecn6S
rlcO9iQCC7jy0f7aB7v027MWl4KeIjJ3A/0DFMWM8FDUMhh1BlEcNcIuK1VD1sND
YR6NbjeleItI6spTyPyMOEXQnnxs19RbwBCchTWhoKCvhmHH2npNrYkE3XSJ+tI4
xmjLdhedIOu2718ILkFb41GsKD1nhIThw8JbjJN0z2zQKKluQ0CsM13w/1E3X4Ur
77E7GlR22QoFNpbq9GWiZp5qYyGMOth4m4JkrTkqE9/zi09cwGs1ndNBIVjik0eU
c5FgWJDYH1oDb4feL/Vt
=/oL8
-----END PGP SIGNATURE-----
More information about the CMake
mailing list