Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 517a1ff

Browse files
committed
add cmake finder
1 parent d4ddb3c commit 517a1ff

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

cmake/Findlibtinkerforge-1.0.cmake

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# - Try to find libtinkerforge-1.0
2+
# Once done this will define
3+
#
4+
# LIBTINKERFORGE_1_FOUND - system has libtinkerforge
5+
# LIBTINKERFORGE_1_INCLUDE_DIRS - the libtinkerforge include directory
6+
# LIBTINKERFORGE_1_LIBRARIES - Link these to use libtinkerforge
7+
# LIBTINKERFORGE_1_DEFINITIONS - Compiler switches required for using libtinkerforge
8+
#
9+
# Adapted from cmake-modules Google Code project
10+
#
11+
# Copyright (c) 2006 Andreas Schneider <[email protected]>
12+
#
13+
# (Changes for libtinkerforge) Copyright (c) 2014 Björn Bilger <[email protected]>
14+
#
15+
# Redistribution and use is allowed according to the terms of the New BSD license.
16+
#
17+
# CMake-Modules Project New BSD License
18+
#
19+
# Redistribution and use in source and binary forms, with or without
20+
# modification, are permitted provided that the following conditions are met:
21+
#
22+
# * Redistributions of source code must retain the above copyright notice, this
23+
# list of conditions and the following disclaimer.
24+
#
25+
# * Redistributions in binary form must reproduce the above copyright notice,
26+
# this list of conditions and the following disclaimer in the
27+
# documentation and/or other materials provided with the distribution.
28+
#
29+
# * Neither the name of the CMake-Modules Project nor the names of its
30+
# contributors may be used to endorse or promote products derived from this
31+
# software without specific prior written permission.
32+
#
33+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
37+
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
40+
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43+
#
44+
45+
46+
if (LIBTINKERFORGE_1_LIBRARIES AND LIBTINKERFORGE_1_INCLUDE_DIRS)
47+
# in cache already
48+
set(LIBTINKERFORGE_FOUND TRUE)
49+
else (LIBTINKERFORGE_1_LIBRARIES AND LIBTINKERFORGE_1_INCLUDE_DIRS)
50+
find_path(LIBTINKERFORGE_1_INCLUDE_DIR
51+
NAMES
52+
tinkerforge/tinkerforge.h
53+
PATHS
54+
/usr/include
55+
/usr/local/include
56+
/opt/local/include
57+
/sw/include
58+
PATH_SUFFIXES
59+
tinkerforge-1.0
60+
)
61+
62+
find_library(LIBTINKERFORGE_1_LIBRARY
63+
NAMES
64+
tinkerforge-1.0
65+
PATHS
66+
/usr/lib
67+
/usr/local/lib
68+
/opt/local/lib
69+
/sw/lib
70+
)
71+
72+
set(LIBTINKERFORGE_1_INCLUDE_DIRS
73+
${LIBTINKERFORGE_1_INCLUDE_DIR}
74+
)
75+
set(LIBTINKERFORGE_1_LIBRARIES
76+
${LIBTINKERFORGE_1_LIBRARY}
77+
)
78+
79+
if (LIBTINKERFORGE_1_INCLUDE_DIRS AND LIBTINKERFORGE_1_LIBRARIES)
80+
set(LIBTINKERFORGE_1_FOUND TRUE)
81+
endif (LIBTINKERFORGE_1_INCLUDE_DIRS AND LIBTINKERFORGE_1_LIBRARIES)
82+
83+
if (LIBTINKERFORGE_1_FOUND)
84+
if (NOT libtinkerforge_1_FIND_QUIETLY)
85+
message(STATUS "Found libtinkerforge-1.0:")
86+
message(STATUS " - Includes: ${LIBTINKERFORGE_1_INCLUDE_DIRS}")
87+
message(STATUS " - Libraries: ${LIBTINKERFORGE_1_LIBRARIES}")
88+
endif (NOT libtinkerforge_1_FIND_QUIETLY)
89+
else (LIBTINKERFORGE_1_FOUND)
90+
message(FATAL_ERROR "Could not find libtinkerforge")
91+
endif (LIBTINKERFORGE_1_FOUND)
92+
93+
# show the LIBTINKERFORGE_1_INCLUDE_DIRS and LIBTINKERFORGE_1_LIBRARIES variables only in the advanced view
94+
mark_as_advanced(LIBTINKERFORGE_1_INCLUDE_DIRS LIBTINKERFORGE_1_LIBRARIES)
95+
96+
endif (LIBTINKERFORGE_1_LIBRARIES AND LIBTINKERFORGE_1_INCLUDE_DIRS)

0 commit comments

Comments
 (0)