[CMake] including lib

Philip Lowman philip at yhbt.com
Wed Feb 27 00:20:16 EST 2008


On Tue, Feb 26, 2008 at 1:28 PM, David Cole <david.cole at kitware.com> wrote:

> Actually, try this: (note the "NAMES")
> find_library(glut NAMES "glut32" PATHS "Z:/Opt/lib" NO_DEFAULT_PATH)
>
> Commands can be upper or lower case, but the arguments to the commands
> that are "special" words must typically still be upper case, exactly as
> documented with --help-command. So NAMES should be all upper case...


Harsha,

Writing your own custom FIND_LIBRARY() invocations works, but take note of
the existence of CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH which are great
variables to use if you're trying to force linking against a library
installed in a non-standard place.  This way you can reuse existing CMake
Find* Modules.  For example:


SET(CMAKE_LIBRARY_PATH "Z:/Opt/lib")
SET(CMAKE_INCLUDE_PATH "Z:/Opt/include")
FIND_PACKAGE(GLUT)
SET(CMAKE_LIBRARY_PATH)  # Clear the contents of the variable for safety
SET(CMAKE_INCLUDE_PATH)  # Clear the contents of the variable for safety



If you're using CMake CVS you can append to the CMAKE_PREFIX_PATH variable
instead (provided the header files are in "include" and the libraries in
"lib" relative to one of the directories specified in the list)

For example, if your libraries were located like so:
/Path/To/CustomGlut/lib/libglut.so
/Path/To/CustomGlut/include/GL/glut.h

SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/Path/To/CustomGlut")
FIND_PACKAGE(GLUT)


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080227/5687b0ee/attachment.html


More information about the CMake mailing list