From a6ebd3986fbff2298bce68a2844d055a806e7920 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 24 May 2016 04:36:55 +0200 Subject: [PATCH] fix(build): Conditionally include network module --- src/CMakeLists.txt | 11 ++++++++--- src/bar.cpp | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12375c0b..d7035017 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,20 +10,26 @@ if(ENABLE_MPD) "src/modules/mpd.cpp") endif() +if(ENABLE_NETWORK) + set(SOURCE_FILES_NETWORK + "src/interfaces/net.cpp" + "src/modules/network.cpp") +endif() + if(ENABLE_I3) set(SOURCE_FILES_I3 "src/modules/i3.cpp") endif() set(SOURCE_FILES ${SOURCE_FILES_ALSA} - ${SOURCE_FILES_MPD} ${SOURCE_FILES_I3} + ${SOURCE_FILES_MPD} + ${SOURCE_FILES_NETWORK} "src/drawtypes/animation.cpp" "src/drawtypes/bar.cpp" "src/drawtypes/icon.cpp" "src/drawtypes/label.cpp" "src/drawtypes/ramp.cpp" - "src/interfaces/net.cpp" "src/modules/backlight.cpp" "src/modules/base.cpp" "src/modules/battery.cpp" @@ -33,7 +39,6 @@ set(SOURCE_FILES "src/modules/date.cpp" "src/modules/memory.cpp" "src/modules/menu.cpp" - "src/modules/network.cpp" "src/modules/script.cpp" "src/modules/text.cpp" # "src/modules/torrent.cpp" diff --git a/src/bar.cpp b/src/bar.cpp index 4fca042a..b2924210 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -21,6 +21,9 @@ #ifdef ENABLE_MPD #include "modules/mpd.hpp" #endif +#ifdef ENABLE_NETWORK +#include "modules/network.hpp" +#endif #ifdef ENABLE_ALSA #include "modules/volume.hpp" #endif @@ -154,7 +157,9 @@ void Bar::load() else if (type == "internal/cpu") module = std::make_unique(mod); else if (type == "internal/date") module = std::make_unique(mod); else if (type == "internal/memory") module = std::make_unique(mod); +#ifdef ENABLE_NETWORK else if (type == "internal/network") module = std::make_unique(mod); +#endif #ifdef ENABLE_I3 else if (type == "internal/i3") module = std::make_unique(mod, this->opts->monitor->name); #endif