From e64d925b45ff4802fe924ea2e8108bb1932b4d01 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 1 Mar 2015 21:15:01 +0100 Subject: o Replacing boost::logging with log4cplus. --- apps/CMakeLists.txt | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'apps/CMakeLists.txt') diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 792e339..ab9c529 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -3,10 +3,15 @@ set(APPS sm-db-insert sm-db-select sm-get-value) -set(shared_sources SoilMoisture.cpp) + +set(APPS ${APPS} log4cplus-test) + +set(shared_sources + SoilMoisture.cpp + apps.cpp) # Boost -find_package(Boost COMPONENTS system log thread program_options REQUIRED) +find_package(Boost COMPONENTS system program_options REQUIRED) # Bluez pkg_check_modules(BLUEZ bluez REQUIRED) @@ -16,6 +21,16 @@ 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 @@ -37,5 +52,7 @@ foreach(app ${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) -- cgit v1.2.3