summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-01 13:19:11 -0500
committerTom Rondeau <trondeau@vt.edu>2013-03-03 17:23:38 -0500
commit4fd16922d4e7ae2e5fd9dd048a873cbef409a7ff (patch)
treeea35645ece07cf4ede44f47ad10e7b8a35213634 /cmake
parentce211603ff8821b50f7c9ebc3931498c6f2bd374 (diff)
log: adding default loggers to all gr_blocks to make using them simpler.
log: improving logger configuration and default behavior. log: changed name from gr_log to gr_logger (felt it could be confuse with the math function log). docs: moved logging information out to its own page.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/GrMiscUtils.cmake43
1 files changed, 26 insertions, 17 deletions
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 088b4e0af1..751aad5b4c 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -210,7 +210,7 @@ function(GR_GEN_TARGET_DEPS name var)
endfunction(GR_GEN_TARGET_DEPS)
########################################################################
-# Control use of gr_log
+# Control use of gr_logger
# Usage:
# GR_LOGGING()
#
@@ -220,26 +220,35 @@ endfunction(GR_GEN_TARGET_DEPS)
function(GR_LOGGING)
find_package(Log4cxx)
- OPTION(ENABLE_GR_LOG "Use gr_log" ON)
-
- if(NOT LOG4CXX_FOUND)
- SET(ENABLE_GR_LOG OFF)
- endif(NOT LOG4CXX_FOUND)
-
- message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
-
- SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
-
+ OPTION(ENABLE_GR_LOG "Use gr_logger" ON)
if(ENABLE_GR_LOG)
+ # If gr_logger is enabled, make it usable
add_definitions( -DENABLE_GR_LOG )
+
+ # also test LOG4CXX; if we have it, use this version of the logger
+ # otherwise, default to the stdout/stderr model.
+ if(LOG4CXX_FOUND)
+ SET(HAVE_LOG4CXX True)
+ add_definitions( -DHAVE_LOG4CXX )
+ else(LOG4CXX_FOUND)
+ SET(HAVE_LOG4CXX False)
+ SET(LOG4CXX_INCLUDE_DIRS "")
+ SET(LOG4CXX_LIBRARY_DIRS "")
+ SET(LOG4CXX_LIBRARIES "")
+ endif(LOG4CXX_FOUND)
+
+ SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
+
else(ENABLE_GR_LOG)
- # If not enabled or available, set these variable to
- # blank so we can use them later without having to
- # check ENABLE_GR_LOG each time.
- SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE)
+ SET(HAVE_LOG4CXX False)
+ SET(LOG4CXX_INCLUDE_DIRS)
+ SET(LOG4CXX_LIBRARY_DIRS)
+ SET(LOG4CXX_LIBRARIES)
endif(ENABLE_GR_LOG)
+
+ message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
+ message(STATUS "HAVE_LOG4CXX set to ${HAVE_LOG4CXX}.")
+
endfunction(GR_LOGGING)
########################################################################