You really should not do 'cd "${CMAKE_BINARY_DIR}"', because that should already be the working directory and cd'ing around is strongly discouraged. Remove that (works fine without on my machine with a quick test). If you must set the working directory, use the WORKING_DIRECTORY option of add_custom_command.
You really should not do 'cd "${CMAKE_ BINARY_ DIR}"', because that should already be the working directory and cd'ing around is strongly discouraged. Remove that (works fine without on my machine with a quick test). If you must set the working directory, use the WORKING_DIRECTORY option of add_custom_command.
Once this is fixed, this is ready to merge.