[CMake] FooConfig.cmake with Foo_DIR issue

Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA artur.kedzierski at navy.mil
Tue Dec 19 19:00:54 EST 2006


	Great! That did it.
	Thank You. 


--
Artur Kedzierski

-----Original Message-----
From: Tristan Carel [mailto:tristan.carel at gmail.com] 
Sent: Tuesday, December 19, 2006 15:10
To: Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA
Cc: CMake Mailing List
Subject: Re: [CMake] FooConfig.cmake with Foo_DIR issue

On 12/19/06, Kedzierski,  Artur CIV NAVSURFWARCENDIV CORONA
<artur.kedzierski at navy.mil> wrote:
>
>
>
>         Hi,
>
>         For a package Foo, I have FooConfig.cmake that contains
> .
> Foo_LIBRARIES "${Foo_DIR}/lib/@Foo_LIBRARY_NAME@"
> .
>         That works fine on Linux. However, on Windows, I get
> Foo_LIBRARIES to be something like: "c:\Program Files\Foo\/lib/foo.lib".
> Is there anyway to tell CMake to substitute Foo_DIR with a path that uses
> forward slashes? The backslashes give me an error in CMake about
> incorrect escape sequences.
>         Thank You.

Hi Artur.

You can fix the non homogeneous paths with the following commands:
FILE(TO_CMAKE_PATH path result)
FILE(TO_NATIVE_PATH path result)

all details here:
http://cmake.org/HTML/Documentation.html

Example:
SET(variable "C:\\Program Files\\Aspell/doc/html")
FILE(TO_CMAKE_PATH "${variable}" variable) # will use /

So try to put this just after the assignment of Foo_DIR:
FILE(TO_CMAKE_PATH "${Foo_DIR}" Foo_DIR)

-- 
Tristan Carel
Music with dinner is an insult both to the cook and the violinist.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4670 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20061219/c1735161/smime-0001.bin


More information about the CMake mailing list