1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
# -*- mode: cmake; -*-
# - Try to find libmbus include dirs and libraries
# Usage of this module as follows:
# This file defines:
# * MBUS_FOUND if protoc was found
# * MBUS_LIBRARY The lib to link to (currently only a static unix lib, not
# portable)
# * MBUS_INCLUDE_DIR The include directories for libmbus.
message(STATUS "FindMBus check")
IF (NOT WIN32)
include(FindPkgConfig)
if ( PKG_CONFIG_FOUND )
pkg_check_modules (PC_MBUS libmbus>=0.8.0)
set(MBUS_DEFINITIONS ${PC_MBUS_CFLAGS_OTHER})
endif(PKG_CONFIG_FOUND)
endif (NOT WIN32)
message(STATUS "Looking for libmbus in ${PC_MBUS_INCLUDEDIR}")
# find the include files
FIND_PATH(MBUS_INCLUDE_DIR mbus/mbus.h
HINTS
${PC_MBUS_INCLUDEDIR}
${PC_MBUS_INCLUDE_DIRS}
${CMAKE_INCLUDE_PATH}
)
# locate the library
IF(WIN32)
SET(MBUS_LIBRARY_NAMES ${MBUS_LIBRARY_NAMES} libmbus.lib)
ELSE(WIN32)
SET(MBUS_LIBRARY_NAMES ${MBUS_LIBRARY_NAMES} mbus)
ENDIF(WIN32)
FIND_LIBRARY(MBUS_LIBRARY NAMES ${MBUS_LIBRARY_NAMES}
HINTS
${PC_MBUS_LIBDIR}
${PC_MBUS_LIBRARY_DIRS}
)
# if the include and the program are found then we have it
IF(MBUS_INCLUDE_DIR AND MBUS_LIBRARY)
SET(MBUS_FOUND "YES")
message("libmbus found: '${MBUS_INCLUDE_DIR}'")
# SET(MBUS_INCLUDE_DIR ${MBUS-C_INCLUDE_DIR})
ENDIF(MBUS_INCLUDE_DIR AND MBUS_LIBRARY)
if( NOT WIN32)
list(APPEND MBUS_LIBRARY "-lm")
endif( NOT WIN32)
MARK_AS_ADVANCED(
MBUS_FOUND
MBUS_LIBRARY
MBUS_INCLUDE_DIR
)
|