I’ve used the pattern
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E ...
successfully many times, but I’m having difficulty where the process I want to run is a Bash shell command rather than a CMAKE -E operation.
Specifically, I want to use ‘chrpath’ to modify some imported ELF files generated by SWIG, changing their RPATHs to RUNPATHs. If I use the most obvious form of the syntax,
install(CODE "execute_process(COMMAND chrpath --convert ${CMAKE_INSTALL_FULL_BINDIR}/../lib/python2.7/sil/*.so
COMMAND_ECHO STDOUT)")
…then each block of text between spaces seems to become quoted:
'chrpath' '--convert' '<my path>/*.so'
open: No such file or directory
elf_open: Invalid argument
… and the command fails.
If, instead, I use the double-bracket syntax (which I can find in examples in various places but doesn’t seem to be documented:)
install(CODE [[execute_process(COMMAND chrpath --convert ${CMAKE_INSTALL_FULL_BINDIR}/../lib/python2.7/sil/*.so
COMMAND_ECHO STDOUT)]])
then it seems to make no difference.
What is the correct syntax to get this to work?