[CMake] Finding a library on Windows

Moritz Moeller cmake at virtualritz.com
Wed Oct 1 21:32:34 EDT 2008


Sorry for the n00b question but I'm totally new to CMake.  :)

I wrote a module to add a package. This works great for the include 
path, but the lib can't be found.
Here is the top part of my find module:

   IF(3DELIGHT_INCLUDE_DIR AND 3DELIGHT_LIBRARY)
       SET(3DELIGHT_FIND_QUIETLY TRUE)
   ENDIF(3DELIGHT_INCLUDE_DIR AND 3DELIGHT_LIBRARY)

   FIND_PATH(3DELIGHT_INCLUDE_DIR ri.h $ENV{DELIGHT}/include)
   MESSAGE(STATUS ${3DELIGHT_INCLUDE_DIR})

   FIND_LIBRARY(3DELIGHT_LIBRARY NAMES 3Delight PATH $ENV{DELIGHT}/lib)
   MESSAGE(STATUS ${3DELIGHT_LIBRARY})


My output is sth. like this:

 > cmake --debug-output -G "NMake Makefiles" .
   Running with debug output on.
      Entering             C:foo/src
      Called from: [1]     C:foo/CMakeLists.txt
   -- C:/Program Files/3Delight/include
      Called from: [2]     C:/Program Files (x86)/ \
        CMake 2.6/share/cmake-2.6/Modules/Find3Delight.cmake
                 [1]     C:/foo/src/CMakeLists.txt
   -- 3DELIGHT_LIBRARY-NOTFOUND
      ...

The file
   ri.h
lives in
   C:/Program Files/3Delight/include
and is found.

The library is called
   3Delight.lib
and lives in
   C:/Program Files/3Delight/lib
but CMake can't find it.

Why does this not work? Is this a case issue (note that '3Delight' is 
spelled with a capital 'D'). Or is this because the libname starts with 
a digit, '3', and not with a letter?

I'm on WinXP 64, using the x64 version of the VC Studio 2008 compiler.

Again, sorry if this is something obvious but I'm a bit lost. :|


Cheers,

Moritz




More information about the CMake mailing list