Add ability to set debug via CMake (1.9.1) 44/1044/7 1.9.1
authorE. Scott Daniels <daniels@research.att.com>
Mon, 30 Sep 2019 17:05:12 +0000 (13:05 -0400)
committerScott Daniels <daniels@research.att.com>
Tue, 1 Oct 2019 18:23:34 +0000 (18:23 +0000)
This change allows the DEBUG flag to be supplied on the CMake command
line, and adds instructions on how to do so in BUILD.

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: Ie5c6185a3016778c7e9c0d51c074c7592c114765

BUILD
CMakeLists.txt

diff --git a/BUILD b/BUILD
index 24e604f..681ba4c 100644 (file)
--- a/BUILD
+++ b/BUILD
@@ -173,4 +173,24 @@ and troff format.  The troff pages are placed into the deb and
 the postscript pages are left in the build directory for the
 developer to convert to PDF, or otherwise use.
 
-
+Debug Mode
+Because RMR is designed to keep its overhead to an absolute minimum,
+messages written to standard error are by default very limited.
+The route table collection thread provides the means to enable
+debug messages on the fly, but only because that thread does not
+impact the sending and receiving of user messages.
+
+If it becomes necessary, for development or problem soving, to have
+the RMR functions generate debugging messages the following
+CMake flag can be given when the CMake environment is created:
+       -DDEBUG=n
+
+The value for 'n' should be 1 or 2 to enable debugging.  The default
+when not given is the same as setting n to zero.
+
+When running in debug mode, RMR will log messages received, sent,
+and other useful information.  Because debugging uses fprintf() there
+is a significant amount of overhead with logging this information and
+thus in debugging mode the user should not expect that usual message
+rates can be achieved, and in some cases may cause messages to drop
+if TCP queues become full.
index 3edb64c..6be67f7 100644 (file)
@@ -36,7 +36,7 @@ cmake_minimum_required( VERSION 3.5 )
 
 set( major_version "1" )               # should be automatically populated from git tag later, but until CI process sets a tag we use this
 set( minor_version "9" )
-set( patch_level "0" )
+set( patch_level "1" )
 
 set( install_root "${CMAKE_INSTALL_PREFIX}" )
 set( install_inc "include/rmr" )
@@ -95,13 +95,22 @@ execute_process(
 #list( GET mmp_version 1 minor_version )
 #list( GET mmp_version 2 patch_level )
 
+if( DEBUG )                                    # if set, we'll set debugging on in the compile
+       set( debugging ${DEBUG} )
+       message( "+++ debugging is being set to ${DEBUG}" )
+else()
+       set( debugging 0 )
+        message( "+++ debugging is set to off" )
+endif()
+unset( DEBUG CACHE )                                   # we don't want this to persist
 
-# define constants used in the version string
+# define constants used in the version string, debugging, etc.
 add_definitions(
        -DGIT_ID=${git_id}
        -DMAJOR_VER=${major_version}
        -DMINOR_VER=${minor_version}
        -DPATCH_VER=${patch_level}
+       -DDEBUG=${debugging}
 )
 
 # ---------------- suss out pkg gen tools so we don't fail generating packages that the system cannot support --------------