[CMake] Building an object with spaces in path
Richard Moreland
rmoreland at acusoft.com
Fri Jul 7 12:33:01 EDT 2006
Hi,
I have a problem when building an object that resides in a path with
spaces. I have the following source tree:
/test
CMakeLists.txt
two words/
CMakeLists.txt
main.cpp
When I attempt to build this (in or out of source, using the generated
Makefile), I get:
make[2]: Entering directory `/home/richard/cmtest/build'
Building CXX object two words/CMakeFiles/main.dir/main.o
/usr/bin/c++ -o two words/CMakeFiles/main.dir/main.o -c
/home/richard/cmtest/two\ words/main.cpp
c++: cannot specify -o with -c or -S and multiple compilations
make[2]: *** [two words/CMakeFiles/main.dir/main.o] Error 1
The error is in the -o argument, because "two words" doesn't get escaped
properly.
I poked at the source a bit and saw that the rule is using an object
filename that never gets escaped properly with ConvertToOutputPath().
There is code in cmMakefileTargetGenerator::WriteObjectBuildFile() that
will run the path through ConvertToOutputPath(), but only if
CMAKE_WINDOWS_OBJECT_PATH is defined.
Defining it fixes my problem, but it seems like the relativeObj should
always be escaped properly before it is put into the RuleVariables.Object.
Here is a link to test project demonstrating problem:
http://ncogni.to/cmake_space_error.tar.gz
Thanks for a great tool.
-Richard
More information about the CMake
mailing list