summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-03 17:24:50 -0500
committerTom Rondeau <trondeau@vt.edu>2013-03-03 17:24:50 -0500
commit5fe234f18360b4680a7b9fef1eb710cb7fe37a07 (patch)
treec6d4466e20ce9f3e2c5742305a379b2e5918b853 /gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
parentdb5fd745919ac0f4bff5fbd528ebeff13536b057 (diff)
parent4fd16922d4e7ae2e5fd9dd048a873cbef409a7ff (diff)
Merge branch 'gr_log'
Diffstat (limited to 'gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake')
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake32
1 files changed, 32 insertions, 0 deletions
diff --git a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
index 9331d5debc..cffe2f6540 100644
--- a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
@@ -208,3 +208,35 @@ function(GR_GEN_TARGET_DEPS name var)
set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
endif()
endfunction(GR_GEN_TARGET_DEPS)
+
+
+########################################################################
+# Control use of gr_log
+# Usage:
+# GR_LOGGING()
+#
+# Will set ENABLE_GR_LOG to 1 by default.
+# Can manually set with -DENABLE_GR_LOG=0|1
+########################################################################
+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}.")
+
+ if(ENABLE_GR_LOG)
+ add_definitions( -DENABLE_GR_LOG )
+ 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)
+ endif(ENABLE_GR_LOG)
+endfunction(GR_LOGGING)