Browse Source

* Fixed bug in config.h (If logging is set to none or stdout the compiler raised some errors)

master
bergmann 6 years ago
parent
commit
f416d5fe32
2 changed files with 15 additions and 3 deletions
  1. +13
    -3
      cmake/config.h.in
  2. +2
    -0
      src/CMakeLists.txt

+ 13
- 3
cmake/config.h.in View File

@@ -5,6 +5,16 @@
#cmakedefine CPPMICROHTTPD_LOGGING_STDCOUT
#cmakedefine CPPMICROHTTPD_LOGGING_CPPLOGGING

namespace __impl
{
struct fake_log
{
template<typename... T_args>
fake_log& operator << (T_args&&...)
{ return *this; }
};
}

#if defined(CPPMICROHTTPD_LOGGING_CPPLOGGING)
#include <cpplogging/interface.h>
#define cppmicrohttpd_log(p_level) \
@@ -20,11 +30,11 @@
cppmicrohttpd_log(debug) << __VA_ARGS__
#else
#define cppmicrohttpd_log_debug(...) \
do { } while (0)
__impl::fake_log()
#endif
#else
#define cppmicrohttpd_log(...) \
do { } while (0)
__impl::fake_log()
#define cppmicrohttpd_log_debug(...) \
do { } while (0)
__impl::fake_log()
#endif

+ 2
- 0
src/CMakeLists.txt View File

@@ -15,6 +15,8 @@ ElseIf ( CPPMICROHTTPD_LOGGING MATCHES cpplogging )
Find_Package ( cpplogging QUIET )
If ( cpplogging_FOUND )
Set ( CPPMICROHTTPD_LOGGING_CPPLOGGING true )
Else ( )
Set ( CPPMICROHTTPD_LOGGING_STDCOUT true )
EndIf ( )
EndIf ( )



Loading…
Cancel
Save