CMakeLists.txt (ed4241a870758498555b18030d465a785f5c8b49) CMakeLists.txt (c256d3273fd9d12e1c6e52402af29877bb738fdb)
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#

--- 32 unchanged lines hidden (view full) ---

41 ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.c
42 ${CMAKE_CURRENT_SOURCE_DIR}/pcap.c
43 ${CMAKE_CURRENT_SOURCE_DIR}/pcapng.c
44 ${CMAKE_CURRENT_SOURCE_DIR}/pcapng-bt.c
45 CACHE INTERNAL "List of C sources")
46set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/btbb.h
47 CACHE INTERNAL "List of C headers")
48
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#

--- 32 unchanged lines hidden (view full) ---

41 ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.c
42 ${CMAKE_CURRENT_SOURCE_DIR}/pcap.c
43 ${CMAKE_CURRENT_SOURCE_DIR}/pcapng.c
44 ${CMAKE_CURRENT_SOURCE_DIR}/pcapng-bt.c
45 CACHE INTERNAL "List of C sources")
46set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/btbb.h
47 CACHE INTERNAL "List of C headers")
48
49# Defaults: BUILD_SHARED=ON, BUILD_STATIC=OFF
50if( NOT DEFINED BUILD_SHARED )
51 set(BUILD_SHARED ON)
52endif( NOT DEFINED BUILD_SHARED )
53if( NOT DEFINED BUILD_STATIC )
54 set(BUILD_STATIC OFF)
55endif( NOT DEFINED BUILD_STATIC )
56
57if( NOT ${BUILD_SHARED} AND NOT ${BUILD_STATIC} )
49if( NOT ${BUILD_SHARED_LIB} AND NOT ${BUILD_STATIC} )
58 message( FATAL_ERROR "Not building static or shared library - at least one must be built")
50 message( FATAL_ERROR "Not building static or shared library - at least one must be built")
59endif( NOT ${BUILD_SHARED} AND NOT ${BUILD_STATIC} )
51endif( NOT ${BUILD_SHARED_LIB} AND NOT ${BUILD_STATIC} )
60
52
61if( ${BUILD_SHARED} )
53if( ${BUILD_SHARED_LIB} )
62 # Shared library
63 message(STATUS "Building shared library")
64 add_library(btbb SHARED ${c_sources})
65 set_target_properties(btbb PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION} SOVERSION 0)
66 set_target_properties(btbb PROPERTIES CLEAN_DIRECT_OUTPUT 1)
54 # Shared library
55 message(STATUS "Building shared library")
56 add_library(btbb SHARED ${c_sources})
57 set_target_properties(btbb PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION} SOVERSION 0)
58 set_target_properties(btbb PROPERTIES CLEAN_DIRECT_OUTPUT 1)
67endif( ${BUILD_SHARED} )
59endif( ${BUILD_SHARED_LIB} )
68
60
69if( ${BUILD_STATIC} )
61if( ${BUILD_STATIC_LIB} )
70 # Static library
71 message(STATUS "Building static library")
72 add_library(btbb-static STATIC ${c_sources})
73 set_target_properties(btbb-static PROPERTIES OUTPUT_NAME "btbb")
74 set_target_properties(btbb-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
62 # Static library
63 message(STATUS "Building static library")
64 add_library(btbb-static STATIC ${c_sources})
65 set_target_properties(btbb-static PROPERTIES OUTPUT_NAME "btbb")
66 set_target_properties(btbb-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
75endif( ${BUILD_STATIC} )
67endif( ${BUILD_STATIC_LIB} )
76
77# PCAP Support
78if( (NOT DEFINED USE_PCAP) OR USE_PCAP )
79 find_package(PCAP)
80
81 if( USE_PCAP AND NOT ${PCAP_FOUND} )
82 message( FATAL_ERROR
83 "Cannot find libpcap, which is required for USE_PCAP")
84 endif()
85
86 if( ${PCAP_FOUND} )
87 include_directories(${PCAP_INCLUDE_DIRS})
68
69# PCAP Support
70if( (NOT DEFINED USE_PCAP) OR USE_PCAP )
71 find_package(PCAP)
72
73 if( USE_PCAP AND NOT ${PCAP_FOUND} )
74 message( FATAL_ERROR
75 "Cannot find libpcap, which is required for USE_PCAP")
76 endif()
77
78 if( ${PCAP_FOUND} )
79 include_directories(${PCAP_INCLUDE_DIRS})
88 if( ${BUILD_SHARED} )
80 if( ${BUILD_SHARED_LIB} )
89 target_link_libraries(btbb ${PCAP_LIBRARIES})
81 target_link_libraries(btbb ${PCAP_LIBRARIES})
90 endif( ${BUILD_SHARED} )
91 if( ${BUILD_STATIC} )
82 endif( ${BUILD_SHARED_LIB} )
83 if( ${BUILD_STATIC_LIB} )
92 target_link_libraries(btbb-static ${PCAP_LIBRARIES})
84 target_link_libraries(btbb-static ${PCAP_LIBRARIES})
93 endif( ${BUILD_STATIC} )
85 endif( ${BUILD_STATIC_LIB} )
94 add_definitions( -DENABLE_PCAP )
95 endif( ${PCAP_FOUND} )
96endif( (NOT DEFINED USE_PCAP) OR USE_PCAP )
97
86 add_definitions( -DENABLE_PCAP )
87 endif( ${PCAP_FOUND} )
88endif( (NOT DEFINED USE_PCAP) OR USE_PCAP )
89
98if( ${BUILD_SHARED} )
90if( ${BUILD_SHARED_LIB} )
99 install(TARGETS btbb
100 LIBRARY DESTINATION lib${LIB_SUFFIX}
101 COMPONENT sharedlibs
102 )
91 install(TARGETS btbb
92 LIBRARY DESTINATION lib${LIB_SUFFIX}
93 COMPONENT sharedlibs
94 )
103endif( ${BUILD_SHARED} )
95endif( ${BUILD_SHARED_LIB} )
104
96
105if( ${BUILD_STATIC} )
97if( ${BUILD_STATIC_LIB} )
106 install(TARGETS btbb-static
107 DESTINATION lib${LIB_SUFFIX}
108 COMPONENT staticlibs
109 )
98 install(TARGETS btbb-static
99 DESTINATION lib${LIB_SUFFIX}
100 COMPONENT staticlibs
101 )
110endif( ${BUILD_STATIC} )
102endif( ${BUILD_STATIC_LIB} )
111
112install(FILES ${c_headers}
113 DESTINATION include
114 COMPONENT headers
115 )
103
104install(FILES ${c_headers}
105 DESTINATION include
106 COMPONENT headers
107 )