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