Zachary Pincus wrote:
Hi folks,
I'm using CMake 2.2-3, and have recently run into some problems with a
stanza of CMake code that looks like this:
SET(src "${IN_DIR}/foo.bar")
SET(tgt "${OUT_DIR}/foo.bar")
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different ${src} ${tgt})
The problem comes when src or tgt have spaces in the paths -- the exec
fails (obviously). Slightly less obviously, this also fails:
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different "${src}" "$ {tgt}")
This seems to work, but I'm not sure if it is portable:
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different "'${src}'" "'$
{tgt}'")
Is there a better option?
Now, when I had set this all up in the context of an ADD_CUSTOM_COMMAND
instead of an EXEC_PROGRAM, things seemed to work -- is there automatic
path escaping for args to custom commands, but not exec'd programs, in
this version of CMake? (For some reason, we had to move to EXEC_PROGRAM
instead of using a custom command...)
The EXECUTE_PROCESS command in CMake 2.4 fixes this and handles argument
escaping automatically just like custom commands.
-Brad
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake