diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-06-08 12:15:42 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-06-08 12:15:42 -0400 |
commit | d71d02d7eb01b56b842d6a71a2b7d087c5513e7b (patch) | |
tree | 27dd93e12a85fac6dc7bd2bfb3d22b94d073918c /cmake | |
parent | a14010ec147e3c86f93245d34be58548493aaed1 (diff) |
Fixing up the gr-log capabilities.
Better handling of enable/disable function, easier integration with all components if log4cxx is or is not there. All components have been updated to be able to use logging. Docs update, too.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindLog4cxx.cmake | 2 | ||||
-rw-r--r-- | cmake/Modules/GrMiscUtils.cmake | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/cmake/Modules/FindLog4cxx.cmake b/cmake/Modules/FindLog4cxx.cmake index c1cc6571ef..b1e4f6f1f7 100644 --- a/cmake/Modules/FindLog4cxx.cmake +++ b/cmake/Modules/FindLog4cxx.cmake @@ -1,7 +1,7 @@ # CMake module to find LOG4CXX library INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_LOG4CXX log4cxx) +PKG_CHECK_MODULES(PC_LOG4CXX liblog4cxx) FIND_PATH( LOG4CXX_INCLUDE_DIRS diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index 189e97c7e2..6b708bf730 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -233,3 +233,35 @@ function(GR_VMCIRCBUF) add_definitions( -DTRY_SHM_VMCIRCBUF ) endif(TRY_SHM_VMCIRCBUF) endfunction(GR_VMCIRCBUF) + + +######################################################################## +# 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) |