I have a .cmake file and I have a custom target in which I need to add a command to find and sign apk files. I do the following:
add_custom_target(${APK_BUILD_TARGET} ALL
COMMAND find ${APK_DIR} -name "*.apk" -exec jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myKey.keystore -storepass myStorePass -keypass myKeyPass {} myName \;
)
I keep getting the error
find: missing argument to `-exec'
If I execute the command alone, in a console, it works fine. I have the same problem with a simple echo command:
COMMAND find ${APK_DIR} -name "*.apk" -exec echo {} \;
I assume something is missing when doing that in COMMAND of add_custom_target, but what?
EDIT:
This work for echo command but not for jarsigner which still gives the previous error:
COMMAND find ${APK_DIR} -name "*.apk" -exec echo {} +
Following this post How to use find -exec in CMake execute_process?
I finally got the correct command line:
add_custom_target(${APK_BUILD_TARGET} ALL
COMMAND find ${APK_DIR} -name "*.apk" -exec jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myKey.keystore -storepass myStorePass -keypass myKeyPass {} myName "\;"
)
So with "\;" instead of just \;