aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Walch <florian@fwalch.com>2015-09-28 12:15:55 +0200
committerFlorian Walch <florian@fwalch.com>2015-11-01 15:41:36 +0100
commitcb87ea7e82f656711de27121bd67cea9afeab40b (patch)
treeba87ff2d8730598ce91e3461e8e16b63217d8081
parent87e5a4131666e44354f280538cbc6bbe52225092 (diff)
downloadrneovim-cb87ea7e82f656711de27121bd67cea9afeab40b.tar.gz
rneovim-cb87ea7e82f656711de27121bd67cea9afeab40b.tar.bz2
rneovim-cb87ea7e82f656711de27121bd67cea9afeab40b.zip
CMake: Disable logging for release build types.
These are: Release, MinSizeRel, and RelWithDebInfo. Closes #2913.
-rw-r--r--CMakeLists.txt11
-rw-r--r--src/nvim/log.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dcc5edb52a..f7dd444105 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,17 @@ if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
+# Disable logging for release-type builds.
+if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DDISABLE_LOG)
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDISABLE_LOG")
+endif()
+if(NOT CMAKE_C_FLAGS_MINSIZEREL MATCHES DDISABLE_LOG)
+ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DDISABLE_LOG")
+endif()
+if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DDISABLE_LOG)
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDISABLE_LOG")
+endif()
+
# Enable assertions for RelWithDebInfo.
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
diff --git a/src/nvim/log.h b/src/nvim/log.h
index 152e90760e..32b7276f14 100644
--- a/src/nvim/log.h
+++ b/src/nvim/log.h
@@ -19,7 +19,7 @@
#define ELOGN(...)
// Logging is disabled if NDEBUG or DISABLE_LOG is defined.
-#ifdef NDEBUG
+#if !defined(DISABLE_LOG) && defined(NDEBUG)
# define DISABLE_LOG
#endif