[CMake] escaping spaces in paths with cmake -E commands?

Brad King brad.king at kitware.com
Mon May 8 13:30:19 EDT 2006


Zachary Pincus wrote:
> Assuming I'm stuck with 2.2.3, what's my best bet: use a  
> CUSTOM_COMMAND, or do you think that the following usage is portable:

If you want it to occur at CMake time then you need EXEC_PROGRAM.  If it 
can wait until build time you should use a custom command.

> EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different "'${src}'" "'$ 
> {tgt}'")

This will probably not work on Windows shells.

> EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different "\"${src}\""  
> "\"${tgt}\"")

This may work.

-Brad


More information about the CMake mailing list