[CMake] how to deal with custom cmake modules ?

Alexander Neundorf a.neundorf-work at gmx.net
Wed Feb 8 02:29:29 EST 2006


Hi, 
 
I'm not sure how to handle the following: 
in kdelibs/ I have a bunch of custom cmake modules, located in 
kdelibs/cmake/modules/. When compiling kdelibs/ I just set 
CMAKE_MODULE_PATH to ${CMAKE_SOURCE_DIR}/cmake/modules/ and it works. 
Then kdelibs/ has to be installed. 
 
After that, when compiling something which depends on kdelibs/, e.g. 
kdebase/, I'd like to reuse the cmake modules from kdelibs/. 
So I could either install the cmake modules from kdelibs/ e.g. 
to /opt/kde4/share/cmake/modules/ (or something like that) and then  
set(CMAKE_MODULE_PATH /opt/kde4/share/cmake/modules/ ) when compiling 
e.g. kdebase. 
The problem here is that e.g. kdebase/ doesn't know where kdelibs/ has 
been installed, and would normally use FindKDE4.cmake to find the 
location. But FindKDE4.cmake would be located at the not yet known 
location :-/ 
Anyway, if kdebase/ would find the installed FindKDE4.cmake, and set its 
CMAKE_MODULE_PATH accordingly, would it be possible to add additional 
directories to CMAKE_MODULE_PATH (i.e. so CMAKE_MODULE_PATH would 
be /opt/kde4/share/cmake/modules;${CMAKE_SOURCE_DIR}/cmake/modules/ ? 
 
The other option would be to install the custom modules from kdelibs/ to 
the system cmake module directory. Then later on kdebase would find them 
automatically, and CMAKE_MODULE_PATH would be only one directory long. 
The (big) drawback of this is that the user needs root privileges to 
install kdelibs/. 
 
But actually I like the first option better (if it wouldn't have the 
problems). 
 
What do you suggest ? 
 
Bye 
Alex 
 
 
 
 

-- 
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl


More information about the CMake mailing list