diff --git a/CMakeLists.txt b/CMakeLists.txt index 520a55b..2369c5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ project (StatsdClient) set (StatsdClient_VERSION_MAJOR 1) set (StatsdClient_VERSION_MINOR 1) -include_directories ("src") add_subdirectory ("src") +add_subdirectory ("demo") configure_file ( "src/StatsdClientConfig.h.in" diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt new file mode 100644 index 0000000..be5e980 --- /dev/null +++ b/demo/CMakeLists.txt @@ -0,0 +1,9 @@ +function (AddTool TOOL) + add_executable(${TOOL} ${TOOL}.cpp) + target_link_libraries(${TOOL} StatsdClient) +endfunction () + +if (NOT WIN32) + AddTool(test_client) + AddTool(system_monitor) +endif () diff --git a/demo/system_monitor.cpp b/demo/system_monitor.cpp index 6318105..c09adfe 100644 --- a/demo/system_monitor.cpp +++ b/demo/system_monitor.cpp @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) total = user + sys + idle; busy = user + sys; - client.send("system.cpu", 100 * (busy - old_busy)/(total - old_total), "g", 1.0); + client.send("system.cpu", 100 * (busy - old_busy)/(total - old_total), "g", 1.0, {}); old_total = total; old_busy = busy; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 197b1b5..3b7a5df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(StatsdClient statsd_client.cpp) -include_directories(${PROJECT_BINARY_DIR}) +target_include_directories(StatsdClient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_BINARY_DIR}) install (TARGETS StatsdClient DESTINATION lib) install (FILES statsd_client.h DESTINATION include)