Fixed: Luabind detection when compiled from sources

This commit is contained in:
kervala 2011-05-23 12:52:35 +02:00
parent a2c71aba53
commit aecf408585

View file

@ -6,7 +6,7 @@
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
# in cache already
SET(LUABIND_FIND_QUIETLY TRUE)
SET(Luabind_FIND_QUIETLY TRUE)
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
FIND_PATH(LUABIND_INCLUDE_DIR
@ -62,30 +62,35 @@ FIND_LIBRARY(LUABIND_LIBRARY_DEBUG
FIND_PACKAGE(Boost REQUIRED)
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
IF(LUABIND_LIBRARY_RELEASE)
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(LUABIND_FOUND TRUE)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
IF(LUABIND_LIBRARY_DEBUG)
SET(LUABIND_LIBRARIES "optimized;${LUABIND_LIBRARY_RELEASE};debug;${LUABIND_LIBRARY_DEBUG}")
ELSE(LUABIND_LIBRARY_DEBUG)
SET(LUABIND_LIBRARIES "${LUABIND_LIBRARY_RELEASE}")
ENDIF(LUABIND_LIBRARY_DEBUG)
ENDIF(LUABIND_LIBRARY_RELEASE)
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
ELSEIF(LUABIND_LIBRARY_RELEASE)
# Normal case
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
ELSEIF(LUABIND_LIBRARY_DEBUG)
# Case where Luabind is compiled from sources (debug version is compiled by default)
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
IF(LUABIND_FOUND)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
# Check if luabind/version.hpp exists
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
IF(LUABIND_VERSION_FILE)
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
ENDIF(LUABIND_VERSION_FILE)
IF(NOT LUABIND_FIND_QUIETLY)
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT LUABIND_FIND_QUIETLY)
ENDIF(NOT Luabind_FIND_QUIETLY)
ELSE(LUABIND_FOUND)
IF(NOT LUABIND_FIND_QUIETLY)
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Luabind!")
ENDIF(NOT LUABIND_FIND_QUIETLY)
ENDIF(NOT Luabind_FIND_QUIETLY)
ENDIF(LUABIND_FOUND)
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)