diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-03 18:15:14 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-04 09:21:57 -0500 |
commit | 647e8263d9c03894d3986482af8cec6315c310c7 (patch) | |
tree | a7fc2f1eed93b489d087901f1a508330231fc7e7 /gr-howto-write-a-block | |
parent | 5fe234f18360b4680a7b9fef1eb710cb7fe37a07 (diff) |
log: more minor fixups integrating gr-logger.
Diffstat (limited to 'gr-howto-write-a-block')
-rw-r--r-- | gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake index cffe2f6540..685ac3c879 100644 --- a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake +++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake @@ -211,7 +211,7 @@ endfunction(GR_GEN_TARGET_DEPS) ######################################################################## -# Control use of gr_log +# Control use of gr_logger # Usage: # GR_LOGGING() # @@ -221,22 +221,33 @@ 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}.") - + 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) |