This is a discussion about how to code module search paths, with regard to distribution porting of cmake. The examples below use MacPorts only because that's what I'm working with at the moment. The issue applies to any port of cmake on a specific distribution system (MacPorts, Fink, debian, freebsd, ubuntu, redhat, etc.).
The main PREFIX on MacPorts is /opt/local/. This will list all the module files that contain /opt/local for an installation of cmake 2.6 on MacPorts: $ grep -C3 ".*/opt/local.*" /opt/local/share/cmake-2.6/Modules/*.cmake Not all the .cmake files contain this prefix. Moreover, even when the /opt/local prefix is in a module search path, it doesn't resolve an issue of path precedence. For example: /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake- PATH_SUFFIXES lib64 lib /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake- PATHS /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake- /sw # Fink /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake: /opt/local # DarwinPorts /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake- /opt/csw # Blastwave /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake- /opt /opt/local/share/cmake-2.6/Modules/Findosg_functions.cmake- /usr/freeware Here, the path precedence favors the main alternative to MacPorts for open-source ports on OSX - Fink. If anyone has both Fink and MacPorts installed, any of their MacPorts cmake builds that require any such module could link against a Fink library because it appears higher in the module path precedence (even when /opt/local is in the module search path). The same argument applies in reverse if the module shuffles around these paths to favor MacPorts over Fink (or some other distribution) in the search path precedence. I'm not aware of a cmake build-time config variable that allows distros to set a specific module search path. That would be really neat! Maybe something like the following when building cmake: -D CMAKE_MODULE_PREFIX_PATH:STRING=/opt/local;/usr/local;/usr -D CMAKE_MODULE_INCLUDE_PATH:STRING=/opt/local/include;/usr/local/include;/usr/include -D CMAKE_MODULE_LIBRARY_PATH:STRING=/opt/local/lib;/usr/local/lib;/usr/lib;/usr/lib64 If something like this could be defined, then module .cmake files could use these cmake variables to define their search paths, rather than have them hard-coded in the module files. If these variables are not set explicitly, some common fallback paths must be set. Darren PS, see this ticket for further details on this issue for MacPorts: http://trac.macports.org/ticket/19781
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake