[CMake] Problems with parsing and CMAKE_MODULE_PATH

Alexander Neundorf a.neundorf-work at gmx.net
Wed Feb 25 15:20:28 EST 2009


On Wednesday 25 February 2009, Jesse Perla wrote:
> I am running cmake 2.6.3 on vista32 1. Is there any way to add a path for
> cmake to permanently look for modules/packages in? 

No...

> I am writing a package,
> which I have in SVN, and I really don't want to copy it back and forth to
> the cmake folder or I will get out of whack. 

...and it wouldn't help for your problem. Do I understand correctly that 
FindETK.cmake is the find-module for your project "ETK" ?
It doesn't help if this module gets installed when you install ETK, since 
FindETK.cmake must (should) also be available when ETK is not installed.
Otherwise you will just get a "file not found" or similar.

You should add the FindETK.cmake to the source tree of the projects which use 
it, and set CMAKE_MODULE_PATH accordingly.

Alternatively you can install a ETKConfig.cmake when installing ETK, this will 
be found automatically by cmake >= 2.6.0, as long as you install it into one 
of the supported directories, see the documentation for FIND_PACKAGE().

> And when I set the 
> CMAKE_MODULE_PATH path in the CMakeLists.txt file, it (sometimes) works but
> this is a pain to do for every single project that uses my package. 2. When
> I do set the CMAKE_MODULE_PATH, I am having strange parsing errors when
> expanding environment variables.
> I have the following environment variables set in vista:
> %ETK_LIBRARIES% = C:\working\libraries\trunk %ETK_BUILD% =
> c:/working/libraries/trunk/build
> Note that I really don't want "build", I just have it in here for a test.
>
> I have a module called FindETK.cmake in the
> C:\working\libraries\trunk\build directory.
>
> In one of my projects using this package, things work fine with:
>
> cmake_minimum_required(VERSION 2.6) set(CMAKE_MODULE_PATH
> $ENV{ETK_LIBRARIES}/build ) find_package(ETK)

I think you should do a FILE(TO_CMAKE_PATH ... ) with the path you get from 
the environment variable, so it has the forward-slashes cmake expects.

Alex


More information about the CMake mailing list