[CMake] Ability to tell if it is a relative path

Tristan Carel tristan.carel at gmail.com
Tue Mar 10 18:54:28 EDT 2009


On Tue, Mar 10, 2009 at 23:42, James Bigler <jamesbigler at gmail.com> wrote:
> Is there a way to discover if a path is a relative path or not?
>
> I need to make sure that all paths are absolute for a given application, and
> I can be given either relative or absolute paths to files.  If I'm given a
> relative path I want to prepend ${CMAKE_CURRENT_SOURCE_DIR} to make it
> absolute, but if it's already absolute, I don't want to add anything.

Hi James,

by grep"ping" `absolute' is the CMake documentation, you find:

if(IS_ABSOLUTE path)
True if the given path is an absolute path.

Cheers
-- 
Tristan Carel
Normal is getting dressed in clothes that you buy for work and driving
through traffic in a car that you are still paying for - in order to
get to the job you need to pay for the clothes and the car, and the
house you leave vacant all day so you can afford to live in it.
http://www.tristancarel.com


More information about the CMake mailing list