diff --git a/cmake/ConkyBuildOptions.cmake b/cmake/ConkyBuildOptions.cmake index 35126468..0187d7f4 100644 --- a/cmake/ConkyBuildOptions.cmake +++ b/cmake/ConkyBuildOptions.cmake @@ -87,6 +87,11 @@ option(BUILD_BUILTIN_CONFIG "Enable builtin default configuration" true) option(BUILD_MATH "Enable math support" true) option(BUILD_NCURSES "Enable ncurses support" true) +if(BUILD_NCURSES) + option(LEAKFREE_NCURSES "Enable to hide false ncurses-memleaks in valgrind (works only when ncurses is compiled with --disable-leaks)" false) +else(BUILD_NCURSES) + set(LEAKFREE_NCURSES false CACHE BOOL "Enable to hide false ncurses-memleaks in valgrind (works only when ncurses is compiled with --disable-leaks)" FORCE) +endif(BUILD_NCURSES) option(BUILD_X11 "Build X11 support" true) if(BUILD_X11) diff --git a/cmake/config.h.in b/cmake/config.h.in index 070872b8..fad59201 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -78,6 +78,7 @@ #cmakedefine BUILD_BUILTIN_CONFIG 1 #cmakedefine BUILD_NCURSES 1 +#cmakedefine LEAKFREE_NCURSES 1 #cmakedefine BUILD_APCUPSD 1 diff --git a/src/conky.cc b/src/conky.cc index 2f6ff6c4..c9b0ac2c 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -66,7 +66,7 @@ #include #ifdef BUILD_NCURSES #include -#ifdef DEBUG +#ifdef LEAKFREE_NCURSES #include "nc.h" #endif #endif @@ -4344,7 +4344,7 @@ int main(int argc, char **argv) kvm_close(kd); #endif -#if defined(BUILD_NCURSES) && defined(DEBUG) +#ifdef LEAKFREE_NCURSES _nc_free_and_exit(0); //hide false memleaks #endif return 0;