blob: 42e8c470f02e65c170701c3689008fda9adb3142 (
plain)
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
|
# - Try to find libmodbus
# Once done this will define
#
# MODBUS_FOUND - system has MODBUS
# MODBUS_INCLUDE_DIR - the MODBUS include directory
# MODBUS_LIBRARIES - Link these to use MODBUS
# Copyright (c) 2006, Jasem Mutlaq <mutlaqja@ikarustech.com>
# Based on FindLibfacile by Carsten Niehaus, <cniehaus@gmx.de>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
# in cache already
set(MODBUS_FOUND TRUE)
message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}")
else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
find_path(MODBUS_INCLUDE_DIR modbus.h
PATH_SUFFIXES modbus
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(MODBUS_LIBRARIES NAMES modbus
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
set(CMAKE_REQUIRED_INCLUDES ${MODBUS_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MODBUS_LIBRARIES})
if(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
set(MODBUS_FOUND TRUE)
else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
set(MODBUS_FOUND FALSE)
endif(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
if (MODBUS_FOUND)
if (NOT MODBUS_FIND_QUIETLY)
message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}")
endif (NOT MODBUS_FIND_QUIETLY)
else (MODBUS_FOUND)
if (MODBUS_FIND_REQUIRED)
message(FATAL_ERROR "libmodbus not found. Please install libmodbus-devel. https://launchpad.net/libmodbus/")
endif (MODBUS_FIND_REQUIRED)
endif (MODBUS_FOUND)
mark_as_advanced(MODBUS_INCLUDE_DIR MODBUS_LIBRARIES)
endif (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
|