list(APPEND APPS log4cplus-test) list(APPEND APPS ble-inspect-device) list(APPEND APPS sample-convert) list(APPEND APPS sm-db-insert) list(APPEND APPS sm-db-select) list(APPEND APPS sm-get-value) list(APPEND APPS sm-serial-read) add_library(trygvis-apps SoilMoisture.cpp SoilMoistureIo.cpp apps.cpp) # Boost find_package(Boost COMPONENTS regex system program_options REQUIRED) # Bluez pkg_check_modules(BLUEZ bluez REQUIRED) # pthreads find_package(Threads REQUIRED) pkg_check_modules(PQXX libpqxx REQUIRED) find_path(LOG4CPLUS_INCLUDE_DIRECTORIES log4cplus/logger.h) if(LOG4CPLUS_INCLUDE_DIRECTORIES MATCHES NOTFOUND) message(FATAL_ERROR "Could not find log4cplus header files") endif() find_library(LOG4CPLUS_LIBRARIES log4cplus) if(LOG4CPLUS_LIBRARIES MATCHES NOTFOUND) message(FATAL_ERROR "Could not find log4cplus library files") endif() 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) target_link_libraries(${app} ble) target_link_libraries(${app} trygvis-apps) target_link_libraries(${app} ${Boost_LIBRARIES}) target_link_libraries(${app} ${BLUEZ_LIBRARIES}) target_link_libraries(${app} ${PQXX_LIBRARIES}) include_directories("${LOG4CPLUS_INCLUDE_DIRECTORIES}") target_link_libraries(${app} ${LOG4CPLUS_LIBRARIES}) target_link_libraries(${app} ${CMAKE_THREAD_LIBS_INIT}) endforeach(app)