Hi Alex, So if I understand it correctly: The find_file() and find_library() commands should be used in FindXXX.cmake files; the check_include_file() and check_library_exists() command can in fact only be used in CMakeLists.txt files. Right? Or am I seeing things too black-and-white?
Regards, Marcel Loose. On Tue, 2009-04-21 at 21:37 +0200, Alexander Neundorf wrote: > On Tuesday 21 April 2009, Marcel Loose wrote: > > Hi all, > > > > I was wondering what is the preferred way to look for a library and/or a > > header file. I noticed that most (if not all) pre-packaged cmake modules > > use find_file and find_library. > > > > Is there a reason that they do not use check_include_file and > > check_library_exists? > > > > If writing my own cmake modules, should I use find_file and > > find_library, or check_include_file and check_library_exists? > > They do different things. > FIND_XXX() returns the full path to the file, which is necessary for use with > cmake. > check_include_file() tries to compile a small file with given > libraries/include dirs, and tests whether that succeeds. So you cannot use > that to find the location of a library or header. > You can use check_library_exists() to check whether e.g. the C library > supports some functions, or whether a header exists in one of the standard > include directories. > > 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 _______________________________________________ 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
