set(APPS ble-inspect-device sm-db-insert sm-get-value) set(shared_sources SoilMoisture.cpp) # Boost find_package(Boost COMPONENTS system log thread program_options REQUIRED) # Bluez pkg_check_modules(BLUEZ bluez REQUIRED) # pthreads find_package(Threads REQUIRED) pkg_check_modules(PQXX libpqxx REQUIRED) include(ExternalProject) ExternalProject_Add( JSON PREFIX json GIT_REPOSITORY https://github.com/nlohmann/json.git GIT_TAG ec42245951fceb7594bfb24746c7449986c3c2a4 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "") foreach(app ${APPS}) include_directories("${PROJECT_SOURCE_DIR}/include") include_directories("${CMAKE_BINARY_DIR}/apps/json/src/JSON/src") add_executable(${app} ${app}.cpp ${shared_sources}) add_dependencies(${app} ble) target_link_libraries(${app} ble) target_link_libraries(${app} ${Boost_LIBRARIES}) target_link_libraries(${app} ${BLUEZ_LIBRARIES}) target_link_libraries(${app} ${PQXX_LIBRARIES}) target_link_libraries(${app} ${CMAKE_THREAD_LIBS_INIT}) endforeach(app)