diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-20 22:56:22 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-20 22:56:22 +0100 |
commit | e44813dddbf5ba063d29ae1e40862e7a7cbb6f43 (patch) | |
tree | 67009d481b8b106af6937a5f386fe4e2e15b1fcc /CMakeLists.txt | |
parent | b6f080193d71334e8afea95ae26afbc03c27fac3 (diff) | |
download | ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.tar.gz ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.tar.bz2 ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.tar.xz ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.zip |
Reorganizing the source code:
o Moving main to apps/
o Moving the library sources to ble/
o Creating cmake files for each piece.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bd0d7a7..a6e2d6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,65 +3,15 @@ project(ble_toys C CXX) find_package(PkgConfig) # Use Clang by default: http://stackoverflow.com/a/7031553/245614 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") -set(SOURCE_FILES "${SOURCE_FILES}" - Bluetooth.cpp - LinuxBluetooth.cpp - ByteBuffer.cpp) - -add_library(ble ${SOURCE_FILES}) - -add_executable(ble_toys main.cpp) -target_link_libraries(ble_toys ble) - # 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}) - 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) - -# If we can change directory here add_definition and test-specific stuff could be moved to the test directory -file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*.cpp) -add_definitions(-DBOOST_TEST_DYN_LINK) - -foreach(testSrc ${TEST_SRCS}) - #Extract the filename without an extension (NAME_WE) - get_filename_component(testName ${testSrc} NAME_WE) - - #Add compile target - add_executable(${testName} ${testSrc}) - - include_directories(${PROJECT_SOURCE_DIR}) - - #link to Boost libraries AND your targets and dependencies - target_link_libraries(${testName} ble) - target_link_libraries(${testName} pthread) - target_link_libraries(${testName} ${Boost_LIBRARIES}) - - #I like to move testing binaries into a testBin directory - set_target_properties(${testName} PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test) - - #Finally add it to test execution - - #Notice the WORKING_DIRECTORY and COMMAND - add_test(NAME ${testName} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test - COMMAND ${CMAKE_BINARY_DIR}/test/${testName} ) -endforeach(testSrc) +add_subdirectory(ble) +add_subdirectory(apps) +add_subdirectory(test) |