[CMake] Quoting, spaces in include paths, CMake input files generation, life, the universe and everything.

Bill Hoffman bill.hoffman at kitware.com
Tue Feb 12 12:14:36 EST 2008


Nicolas Tisserand wrote:
> Hi all,
> 
> I am maintaining a build system for a project that uses a number of
> external libraries whose sources are built with the whole project (ie:
> not looked up in the host system).
> Below is a trimmed down version of how the project is set up.
> In that trimmed down version, libfoo is an external library, libbar a
> custom library, built on top of libfoo, and exebaz an executable
> depending on libbar (and thus on libfoo).
> 
> 
> ---- /extern/libfoo/UseFoo.cmake.in
> 
> SET(FOO_INCLUDES @FOO_INCLUDES@)
> INCLUDE_DIRECTORIES(${FOO_INCLUDES})
> 

This should work:
SET(FOO_INCLUDES "@FOO_INCLUDES@")

 From the documentation of SET:
"  SET(VAR VALUE1 ... VALUEN).
...
In this case VAR is set to a semicolon separated list of values."

(http://www.cmake.org/HTML/Documentation.html)

If you looked at your UseFoo.cmake, you would see that you have 
something like this:

SET(FOO_INCLUDES C:\Document and Settings\user\Desktop)
Which will break it down into a ; separated list of strings.

So, there is no need for extra escaping or anything like that.

-Bill



More information about the CMake mailing list