xref: /libbtbb/lib/src/CMakeLists.txt (revision e25b118a40ed6b5c2ea76bae29e388cfbc2f6e92)
1*e25b118aSDominic Spill#
2*e25b118aSDominic Spill# This file is part of Libbtbb.
3*e25b118aSDominic Spill#
4*e25b118aSDominic Spill# This program is free software; you can redistribute it and/or modify
5*e25b118aSDominic Spill# it under the terms of the GNU General Public License as published by
6*e25b118aSDominic Spill# the Free Software Foundation; either version 2, or (at your option)
7*e25b118aSDominic Spill# any later version.
8*e25b118aSDominic Spill#
9*e25b118aSDominic Spill# This program is distributed in the hope that it will be useful,
10*e25b118aSDominic Spill# but WITHOUT ANY WARRANTY; without even the implied warranty of
11*e25b118aSDominic Spill# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*e25b118aSDominic Spill# GNU General Public License for more details.
13*e25b118aSDominic Spill#
14*e25b118aSDominic Spill# You should have received a copy of the GNU General Public License
15*e25b118aSDominic Spill# along with this program; see the file COPYING.  If not, write to
16*e25b118aSDominic Spill# the Free Software Foundation, Inc., 51 Franklin Street,
17*e25b118aSDominic Spill# Boston, MA 02110-1301, USA.
18*e25b118aSDominic Spill#
19*e25b118aSDominic Spill# Based slightly upon the hackrf cmake setup.
20*e25b118aSDominic Spill
21*e25b118aSDominic Spill# Source
22*e25b118aSDominic Spillset(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_packet.c
23*e25b118aSDominic Spill              ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_piconet.c
24*e25b118aSDominic Spill              ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.c
25*e25b118aSDominic Spill			  CACHE INTERNAL "List of C sources")
26*e25b118aSDominic Spillset(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.h
27*e25b118aSDominic Spill              ${CMAKE_CURRENT_SOURCE_DIR}/btbb.h
28*e25b118aSDominic Spill			  CACHE INTERNAL "List of C headers")
29*e25b118aSDominic Spill
30*e25b118aSDominic Spill
31*e25b118aSDominic Spill# For cygwin just force UNIX OFF and WIN32 ON
32*e25b118aSDominic Spillif( ${CYGWIN} )
33*e25b118aSDominic Spill	SET(UNIX OFF)
34*e25b118aSDominic Spill	SET(WIN32 ON)
35*e25b118aSDominic Spillendif( ${CYGWIN} )
36*e25b118aSDominic Spill
37*e25b118aSDominic Spill# FIXME: This may be a hack
38*e25b118aSDominic Spill# perhaps there should be separate libbtbb and libbtbb-static targets?
39*e25b118aSDominic Spillif( ${WIN32} )
40*e25b118aSDominic Spill	# Static library
41*e25b118aSDominic Spill	add_library(btbb STATIC ${c_sources})
42*e25b118aSDominic Spill	set_target_properties(btbb PROPERTIES OUTPUT_NAME "btbb_static")
43*e25b118aSDominic Spillelse()
44*e25b118aSDominic Spill	# Dynamic library
45*e25b118aSDominic Spill	add_library(btbb SHARED ${c_sources})
46*e25b118aSDominic Spill	set_target_properties(btbb PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.0 SOVERSION 0)
47*e25b118aSDominic Spillendif()
48*e25b118aSDominic Spill
49*e25b118aSDominic Spillset_target_properties(btbb PROPERTIES CLEAN_DIRECT_OUTPUT 1)
50*e25b118aSDominic Spill
51*e25b118aSDominic Spillif( ${UNIX} )
52*e25b118aSDominic Spill   install(TARGETS btbb
53*e25b118aSDominic Spill           LIBRARY DESTINATION lib${LIB_SUFFIX}
54*e25b118aSDominic Spill           COMPONENT sharedlibs
55*e25b118aSDominic Spill           )
56*e25b118aSDominic Spill   install(FILES ${c_headers}
57*e25b118aSDominic Spill           DESTINATION include/${PROJECT_NAME}
58*e25b118aSDominic Spill           COMPONENT headers
59*e25b118aSDominic Spill           )
60*e25b118aSDominic Spillendif( ${UNIX} )
61*e25b118aSDominic Spill
62*e25b118aSDominic Spillif( ${WIN32} )
63*e25b118aSDominic Spill   install(TARGETS btbb
64*e25b118aSDominic Spill           DESTINATION bin
65*e25b118aSDominic Spill           COMPONENT staticlibs
66*e25b118aSDominic Spill           )
67*e25b118aSDominic Spill   install(FILES ${c_headers}
68*e25b118aSDominic Spill           DESTINATION include/${PROJECT_NAME}
69*e25b118aSDominic Spill           COMPONENT headers
70*e25b118aSDominic Spill           )
71*e25b118aSDominic Spillendif( ${WIN32} )
72