aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt7
-rw-r--r--include/salticidae/util.h5
-rw-r--r--src/config.h.in7
4 files changed, 13 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 0b0d2ec..eff5651 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ cmake-build-debug/
libsalticidae.a
src/*.swo
src/*.swp
+include/salticidae/config.h
*.a
*.o
*.la
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c004fd8..587584f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,11 +53,8 @@ endif()
option(SALTICIDAE_ENABLE_DEBUG_LOG "enable debug log" OFF)
option(SALTICIDAE_ENABLE_NORMAL_LOG "enable regular log" ON)
-if (SALTICIDAE_ENABLE_DEBUG_LOG)
- add_definitions(-DSALTICIDAE_DEBUG_LOG)
-elseif(SALTICIDAE_ENABLE_NORMAL_LOG)
- add_definitions(-DSALTICIDAE_NORMAL_LOG)
-endif()
+
+configure_file(src/config.h.in include/salticidae/config.h @ONLY)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -W -Wall -Wextra -pedantic -Wsuggest-override")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -W -Wall -Wextra -pedantic -Wsuggest-override")
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index 505f014..e589693 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -34,6 +34,7 @@
#include <getopt.h>
#include <event2/event.h>
+#include "salticidae/config.h"
#include "salticidae/ref.h"
namespace salticidae {
@@ -83,12 +84,12 @@ class Logger {
extern Logger logger;
-#ifdef SALTICIDAE_DEBUG_LOG
+#ifdef SALTICIDAE_ENABLE_DEBUG_LOG
#define SALTICIDAE_NORMAL_LOG
#define SALTICIDAE_ENABLE_LOG_DEBUG
#endif
-#ifdef SALTICIDAE_NORMAL_LOG
+#ifdef SALTICIDAE_ENABLE_NORMAL_LOG
#define SALTICIDAE_ENABLE_LOG_INFO
#define SALTICIDAE_ENABLE_LOG_WARN
#endif
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644
index 0000000..7637923
--- /dev/null
+++ b/src/config.h.in
@@ -0,0 +1,7 @@
+#ifndef _SALTICIDAE_CONFIG_H
+#define _SALTICIDAE_CONFIG_H
+
+#cmakedefine SALTICIDAE_ENABLE_DEBUG_LOG
+#cmakedefine SALTICIDAE_ENABLE_NORMAL_LOG
+
+#endif