Cmake file for finding Luabind

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1274315640.1491.8.camel@octavo>
Hi All,

I took a copy of the Lua 5.1 cmake file and changed it to find Luabind.
It no doubt could be improved, however it's working find for me on
Linux.  It should in theory work on Win and Mac too.

I thought it might be useful to others, so here it is! :-)

Nigel

------------------------------------------------------------------------------

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
FindLuabind.cmake (text/x-cmake, 1.7 KB)
# Locate Luabind library
# This module defines
#  LUABIND_FOUND, if false, do not try to link to Luabind
#  LUABIND_LIBRARIES
#  LUABIND_INCLUDE_DIR, where to find luabind.hpp
#
# Note that the expected include convention is
#  #include <luabind/luabind.hpp>
# and not
#  #include <luabind.hpp>

IF( NOT LUABIND_FIND_QUIETLY )
    MESSAGE(STATUS "Looking for Luabind...")
ENDIF()

FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp
  HINTS
  $ENV{LUABIND_DIR}
  PATH_SUFFIXES luabind include/luabind include
  PATHS
  ~/Library/Frameworks
  /Library/Frameworks
  /usr/local
  /usr
  /opt/local # DarwinPorts
  /opt
)

FIND_LIBRARY(LUABIND_LIBRARY 
  NAMES luabind 
  HINTS
  $ENV{LUABIND_DIR}
  PATH_SUFFIXES lib64 lib
  PATHS
  ~/Library/Frameworks
  /Library/Frameworks
  /usr/local
  /usr
  /opt/local
  /opt
)

FIND_LIBRARY(LUABIND_LIBRARY_DBG 
  NAMES luabindd
  HINTS
  $ENV{LUABIND_DIR}
  PATH_SUFFIXES lib64 lib
  PATHS
  ~/Library/Frameworks
  /Library/Frameworks
  /usr/local
  /usr
  /opt/local
  /opt
)

IF(LUABIND_LIBRARY)
    SET( LUABIND_LIBRARIES "${LUABIND_LIBRARY}" CACHE STRING "Luabind Libraries")
ENDIF(LUABIND_LIBRARY)

INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUABIND_FOUND to TRUE if 
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Luabind  DEFAULT_MSG  LUABIND_LIBRARIES LUABIND_INCLUDE_DIR)

IF( NOT LUABIND_FIND_QUIETLY )
    IF( LUABIND_FOUND )
        MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARY}" )
    ENDIF()
    IF( LUABIND_LIBRARY_DBG )
        MESSAGE(STATUS "Luabind debug library availible: ${LUABIND_LIBRARY_DBG}")
    ENDIF()
ENDIF()

MARK_AS_ADVANCED(LUABIND_INCLUDE_DIR LUABIND_LIBRARIES LUABIND_LIBRARY LUABIND_LIBRARY_DBG)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.