[CMake] Joining & Normalizing paths

Robert Dailey rcdailey at gmail.com
Tue Nov 1 14:21:23 EDT 2011


I don't see a way to join or normalize paths in CMake. For example, there
is a "base path" that the user can specify in a cache variable, like so:

BASE_PATH = "T:/stuff/"

Later in my CMake script, I join a subpath to it like so:

"${BASE_PATH}/morestuff"

The problem is, this becomes:

"T:/stuff//morestuff"

Notice the double slash. Also if the user specifies backslashes in the
variable, you get this:

"T:\stuff\/morestuff"

Normalization would be ideal here, or a way to properly join the paths like
so:

path( JOIN "${BASE_PATH}" "morestuff" )

Which would yield the cmake path:

"T:/stuff/morestuff"

Is any of this possible? How do I work around this?

---------
Robert Dailey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111101/eaecabc6/attachment.htm>


More information about the CMake mailing list