file.txt While I put $ in it,...">

Custom_command ECHO with special character

I am trying to add custom_command with CMake and call COMMAND echo "$"> file.txt

While I put $ in it, the configuration file will generate but will not be created.

I also tried echo "\ $" and does not seem to work.

add_custom_command( TARGET ${TARGET_NAME} POST_BUILD WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/out COMMAND echo "-keep class com.android.**\$* { ; }" >> ./proguard.txt ) 

The cmake command works, but while I call the ninja, I got the following error:

 error: 'src', needed by 'all', missing and no known rule to make it 

It seems that cmake cannot generate the build step. My intention is to print this **$ in a file.

+1
cmake
source share
1 answer

AND

 COMMAND echo "$$" > file.txt 

and

 COMMAND echo "$" > file.txt VERBATIM 

$ output to the specified file.

EDIT . This works with makefile generators and only when make starts from the terminal. Typically, the redirect character ">" does not work as expected in the COMMAND expression.

0
source share

All Articles