On Tuesday 23 November 2010, Johannes Zarl wrote: > Sorry for hijacking this thread, but I'm wondering about this for some > time, too. (And the information in the doc/wiki is somewhat dated and/or > ambiguous [1,2,3,4]). I will just go on and write my thoughts and what I > (think I) know, in the hope that somebody corrects those things I got > wrong. > > So summarizing the previous mesage in the thread, one can say: > + cmake aware packages should provide LibraryConfig.cmake scripts > (and optionally LibraryVersion.cmake scrips), just like they would > provide pkg-config files. > + developers should create FindLibrary.cmake scripts for packages > they are using that are not cmake aware.
Yes. > I think that information should be transported more clearly, because > in practice most cmake based software provides a FindLibrary.cmake > file for itself. If that's the case, that's wrong. > Also, I could not find a definitive answer on where these packages > should put the LibraryConfig.cmake script. If I read the search paths in > [1] correctly, the preferred paths are: > + <prefix>/ on windows > + <prefix>/(share|lib)/cmake/<name>*/ on linux, and > + <prefix>/<name>.framework/Resources/ on Apple Yes. > We have have every library and library-version in its own prefix and use > shell modules[5] to provide the correct environment that a user wants. > Is there any way to let cmake know about specific prefix directories it > should be aware of? Unfortunately, the CMAKE_MODULE_PATH variable has > to be manually set, and not influenced by the environment. CMAKE_MODULE_PATH is only for finding Find-modules, not for finding the actual packages or Config-files. For that you can set CMAKE_PREFIX_PATH. CMake uses each directory contained in CMAKE_PREFIX_PATH for all its find_program/file/path/library/package() calls to search in the respective subdirectories for the executables/files/libraries/Config-files. > Something like the PKG_CONFIG_PATH environment variable for pkg-config > would be really nice to have in cmake. > > Another somehow related topic seems to be import/export of targets. Should > a LibraryConfig.cmake or FindLibrary.cmake file create imported targets > for the library? Yes. > And is there any documentation on how to create a LibraryConfig.cmake file > with support for components? In KDE we have a macro MACRO_WRITE_BASIC_CMAKE_VERSION_FILE() which helps with creating a basic version-info file which should be installed along with the Config-file. It consists of MacroWriteBasicCMakeVersionFile.cmake and BasicFindPackageVersion.cmake.in which you can find in http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/ . Alex _______________________________________________ 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