[CMake] Joining & Normalizing paths
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Nov 1 14:27:16 EDT 2011
On Tuesday 01 November 2011, Robert Dailey wrote:
> 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?
Does file(TO_CMAKE_PATH ... ) what you want ?
Alex
More information about the CMake
mailing list