[CMake] Problems using FIND_LIBRARY

Mike Jackson imikejackson at gmail.com
Fri Sep 28 15:09:58 EDT 2007


I am trying to write a FindTBB.cmake file (Intel's Threading Building  
Blocks). For some reason FIND_LIBRARY is not finding "libtbb.dylib"  
on my system in the location that I have it installed. HEre is my  
FindTBB.cmake file:

#-- Clear the Library List
SET (TBB_LIBRARIES "")
SET (TBB_LIBRARY "")
#-- Clear the include Directories
SET (TBB_INCLUDE_DIRS "")
SET (TBB_FOUND "NO")
SET (TBB_INSTALL_DIR "$ENV{TBB_INSTALL_DIR}")
MESSAGE (STATUS "TBB_INSTALL_DIR: ${TBB_INSTALL_DIR}")

SET (TBB_INCLUDE_DIR ${TBB_INSTALL_DIR}/include )
SET (TBB_LIB_DIR ${TBB_INSTALL_DIR}/lib )

FIND_PATH(TBB_INCLUDE_DIR tbb/tbb_stddef.h
     /usr/local/include
     /usr/include
     "${TBB_INCLUDE_DIR}"
)
MESSAGE (STATUS "TBB_INCLUDE_DIR: ${TBB_INCLUDE_DIR}")
MESSAGE (STATUS "TBB_LIB_DIR: ${TBB_LIB_DIR}")
SET (TBB_SEARCH_LIBRARY "tbb")
FIND_LIBRARY(TBB_LIBRARY "${TBB_SEARCH_LIBRARY}"   ${TBB_LIB_DIR} )
MESSAGE(STATUS "TBB_LIBRARY: ${TBB_LIBRARY}")
IF (TBB_INCLUDE_DIR)
   IF (TBB_LIBRARY)
     SET (TBB_LIBRARY "YES")
     SET (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_LIBRARIES} )
     INCLUDE_DIRECTORIES( ${TBB_INCLUDE_DIR} )
   ELSE (TBB_LIBRARY)
     SET (TBB_FOUND "NO")
   ENDIF (TBB_LIBRARY)
ENDIF (TBB_INCLUDE_DIR)
IF (TBB_FOUND)
    MARK_AS_ADVANCED (
     TBB_LIBRARY
     TBB_INCLUDE_DIR
    )
ELSE (TBB_FOUND)
       MESSAGE (STATUS "Threading Building Blocks Installed in $ 
{TBB_INSTALL_DIR}")
       MESSAGE (STATUS "Looked for TBB libraries named $ 
{TBB_SEARCH_LIBRARY}")
       MESSAGE (FATAL_ERROR "Could NOT find TBB library")
ENDIF (TBB_FOUND)
#------------------- DONE ----------------------------
TBB_LIBRARY is NOT getting defined. I know it is something trivial  
that I am missing because I have a FindHDF5.cmake file that is the  
same thing (I copied from that to start with) and that one works just  
fine to find my libhdf5.dylib library.

I have checked permissions on all the folders in the path to where  
libtbb.dylib is installed, including the library itself. I installed  
the library in /usr/local/lib. Lots of things but FIND_LIBRARY is  
just not finding it. I know it is simple. Could someone offer any  
suggestions?


Thanks
--
Mike Jackson
imikejackson & gmail * com





More information about the CMake mailing list