MantisBT - CMake
View Issue Details
0013595CMakeCMakepublic2012-10-17 14:522013-03-04 08:38
Matt Coffin 
 
normalminoralways
closedno change required 
AppleMac OS X10.8.2
CMake 2.8.9 
 
0013595: CMAKE_COMMAND handles spaces in path poorly when used in CMAKE_CXX_LINK_EXECUTABLE
When ${CMAKE_COMMAND} is used from within CMAKE_CXX_LINK_EXECUTABLE, spaces in the pathname are not handled as escape characters, so the executable cannot be found. This happens when using a custom toolchain most often. The problem is easily remedied by manually editing link.txt and putting backslashes before the spaces in the path, but this should really be something that CMake handles itself, right? Sorry if there's poor formatting or lack of information. I can grab more info if need be. Its my first bug post.
The following toolchain file for cross-compiling for powerpc-wrs-vxworks will reproduce the problem nicely. But I suspect any use of ${CMAKE_COMMAND} in CMAKE_CXX_LINK_EXECUTABLE will reproduce the same problem as it is all about how spaces are handled when the executable's path is written to link.txt.

The toolchain file can be found at https://github.com/mcoffin/cmake_vxworks. [^]

If you wish to build a cross-compiler environment identical to mine, the patches for GCC and relevant build scripts are at https://github.com/rbmj/vxworks-gcc-patches. [^]

WPILib for GCC is at https://github.com/rbmj/wpilib, [^] but I can't imagine that one would need all of this to reproduce the problem, I'm just simply offering my setup just in case
There is a space by default in the installation path for CMake on OSX, so this problem will most likely effect all users that installed to the default location under OSX. I just realized I can attach files, so I'll toss in the "culprit" link.txt that is generated by that toolchain file. Just look at the last line to see why the space causes a problem.
No tags attached.
txt link.txt (1,435) 2012-10-17 14:52
https://public.kitware.com/Bug/file/4526/*
txt vxworks_toolchain.cmake.txt (7,603) 2012-10-17 14:59
https://public.kitware.com/Bug/file/4527/vxworks_toolchain.cmake.txt
Issue History
2012-10-17 14:52Matt CoffinNew Issue
2012-10-17 14:52Matt CoffinFile Added: link.txt
2012-10-17 14:59Matt CoffinFile Added: vxworks_toolchain.cmake.txt
2012-10-17 15:32Brad KingNote Added: 0031254
2012-10-17 15:32Brad KingStatusnew => resolved
2012-10-17 15:32Brad KingResolutionopen => no change required
2013-03-04 08:38Robert MaynardNote Added: 0032474
2013-03-04 08:38Robert MaynardStatusresolved => closed

Notes
(0031254)
Brad King   
2012-10-17 15:32   
Use "<CMAKE_COMMAND>", not "${CMAKE_COMMAND}". This is already done in several upstream platform modules:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Windows-Intel.cmake;hb=v2.8.9#l102 [^]

Please bring this up on the mailing list if you need further help:

 http://www.cmake.org/mailman/listinfo/cmake [^]
(0032474)
Robert Maynard   
2013-03-04 08:38   
Closing resolved issues that have not been updated in more than 4 months.