On 11/22/2010 11:28 PM, Ian Monroe wrote: > So with a library, the correct thing to do is to install your > FindLibrary.cmake into ${CMAKE_ROOT}/Modules and then dependent > projects would just do find_package(Library REQUIRED) correct?
If the library is built with CMake it should provide a configuration file LibraryConfig.cmake or library-config.cmake and install it to a proper location, e.g. <prefix>/(share|lib) on *nix. Hence, you don't need to write to ${CMAKE_ROOT}/Modules, and FIND_PACKAGE() looks for a configuration file by a more sophisticated procedure as for a find module. Usually, the latters are meant for non CMake-aware packages. > I guess I'm thinking about how, in the situation where they don't have > the library installed, they would then just get a cmake error that it > can't find the FindLibrary.cmake. So that doesn't really seem right. It's the REQUIRED flag which throws the fatal error if neither a find module nor a configuration file is found. Dropping this flag, you might refer to the Library_FOUND variable set explicitly by FindLibrary.cmake or automatically by FIND_PACKAGE() according to whether a configuration file has been found or not: FIND_PACKAGE(Library) IF(NOT Library_FOUND) # Handle Library's absence. ENDIF() > We're going from SVN to Git and splitting up a monolithic project > (kdebindings) into several separate projects (qtruby, korundum, > smoke...). I really don't want to have a copy of FindLibrary.cmake > (well really FindSmoke.cmake) in each project's repo. IMO, it's sufficient to have a SmokeConfig.cmake in smoke's repository and install it along with smoke's other stuff. Later on, you refer to smoke like mentioned above, or with the REQUIRED flag if you cannot proceeed without smoke being found. > This seems like a common situation, so I'm wondering what the common > solution is. 'hope that helps. Regards, Michael _______________________________________________ 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