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 <[email protected]> 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 <[email protected]>
> 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
-- 

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

Reply via email to