aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-18 17:10:28 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-18 17:10:28 +0100
commit67478ec6b3f09c14195b8aea1099afb9bcaf9532 (patch)
tree323c80de857b9d34117eb5fbc2fc956403cdf312
parentdd6a36ea62b8c3e5f20f6d5fd432dec2275aac5a (diff)
downloadble-toys-67478ec6b3f09c14195b8aea1099afb9bcaf9532.tar.gz
ble-toys-67478ec6b3f09c14195b8aea1099afb9bcaf9532.tar.bz2
ble-toys-67478ec6b3f09c14195b8aea1099afb9bcaf9532.tar.xz
ble-toys-67478ec6b3f09c14195b8aea1099afb9bcaf9532.zip
o Improved CMake.
-rw-r--r--CMakeLists.txt31
1 files changed, 19 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c596e8..e09c024 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,16 +1,9 @@
cmake_minimum_required(VERSION 2.8.4)
-project(ble_toys)
+project(ble_toys C CXX)
+find_package(PkgConfig)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
-set(Boost_USE_STATIC_LIBS OFF)
-set(Boost_USE_MULTITHREADED OFF)
-set(Boost_USE_STATIC_RUNTIME OFF)
-
-add_definitions(-DBOOST_ALL_DYN_LINK)
-
-find_package(Boost COMPONENTS system log thread REQUIRED)
-
set(SOURCE_FILES "${SOURCE_FILES}"
Bluetooth.cpp
LinuxBluetooth.cpp
@@ -19,11 +12,25 @@ set(SOURCE_FILES "${SOURCE_FILES}"
add_library(ble ${SOURCE_FILES})
add_executable(ble_toys main.cpp)
+target_link_libraries(ble_toys ble)
-target_link_libraries(ble_toys bluetooth)
-target_link_libraries(ble_toys pthread)
+# Boost
+set(Boost_USE_STATIC_LIBS OFF)
+set(Boost_USE_MULTITHREADED OFF)
+set(Boost_USE_STATIC_RUNTIME OFF)
+
+find_package(Boost COMPONENTS system log thread REQUIRED)
target_link_libraries(ble_toys ${Boost_LIBRARIES})
-target_link_libraries(ble_toys ble)
+
+add_definitions(-DBOOST_ALL_DYN_LINK)
+
+# Bluez
+pkg_check_modules(BLUEZ bluez REQUIRED)
+target_link_libraries(ble_toys ${BLUEZ_LIBRARIES})
+
+# pthreads
+find_package(Threads REQUIRED)
+target_link_libraries(ble_toys ${CMAKE_THREAD_LIBS_INIT})
enable_testing()
find_package(Boost COMPONENTS log unit_test_framework REQUIRED)