summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authoruser <user@ubuntu.(none)>2013-03-12 07:57:39 -0700
committeruser <user@ubuntu.(none)>2013-03-12 07:57:39 -0700
commitafae86a4354c2c82030def9c90b8fe74dcbf4f9d (patch)
tree764421dfac0b5309136bb5236a7763d50725514e /cmake
parent64d8f82c531a477262304bf93b98c2de4eb83d35 (diff)
Converted gr_logger to use log4cpp
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindLog4cpp.cmake58
-rw-r--r--cmake/Modules/GrMiscUtils.cmake35
2 files changed, 77 insertions, 16 deletions
diff --git a/cmake/Modules/FindLog4cpp.cmake b/cmake/Modules/FindLog4cpp.cmake
new file mode 100644
index 0000000000..0b7208630f
--- /dev/null
+++ b/cmake/Modules/FindLog4cpp.cmake
@@ -0,0 +1,58 @@
+# - Find Log4cpp
+# Find the native LOG4CPP includes and library
+#
+# LOG4CPP_INCLUDE_DIR - where to find LOG4CPP.h, etc.
+# LOG4CPP_LIBRARIES - List of libraries when using LOG4CPP.
+# LOG4CPP_FOUND - True if LOG4CPP found.
+
+
+if (LOG4CPP_INCLUDE_DIR)
+ # Already in cache, be silent
+ set(LOG4CPP_FIND_QUIETLY TRUE)
+endif ()
+
+find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh
+ /opt/local/include
+ /usr/local/include
+ /usr/include
+)
+
+set(LOG4CPP_NAMES log4cpp)
+find_library(LOG4CPP_LIBRARY
+ NAMES ${LOG4CPP_NAMES}
+ PATHS /usr/lib /usr/local/lib /opt/local/lib
+)
+
+message("#####################")
+message("LOG INCLEUDE :${LOG4CPP_INCLUDE_DIR}")
+message("LOG LIBRARY :${LOG4CPP_LIBRARY}")
+
+
+message("#####################")
+
+if (LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY)
+ set(LOG4CPP_FOUND TRUE)
+ set(LOG4CPP_LIBRARIES ${LOG4CPP_LIBRARY} )
+else ()
+ set(LOG4CPP_FOUND FALSE)
+ set(LOG4CPP_LIBRARIES )
+endif ()
+
+if (LOG4CPP_FOUND)
+ if (NOT LOG4CPP_FIND_QUIETLY)
+ message(STATUS "Found LOG4CPP: ${LOG4CPP_LIBRARIES}")
+ endif ()
+else ()
+ if (LOG4CPP_FIND_REQUIRED)
+ message(STATUS "Looked for LOG4CPP libraries named ${LOG4CPPS_NAMES}.")
+ message(FATAL_ERROR "Could NOT find LOG4CPP library")
+ endif ()
+endif ()
+
+message("internal libs: ${LOG4CPP_LIBRARIES}")
+
+mark_as_advanced(
+ LOG4CPP_LIBRARY
+ LOG4CPP_LIBRARIES
+ LOG4CPP_INCLUDE_DIR
+ )
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index c7fe77bc88..65b0b5a8c8 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -218,36 +218,39 @@ endfunction(GR_GEN_TARGET_DEPS)
# Can manually set with -DENABLE_GR_LOG=0|1
########################################################################
function(GR_LOGGING)
- find_package(Log4cxx)
+ find_package(Log4cpp)
+
+ message(STATUS "LOG4CPP_LIBRARIES First set to ${LOG4CPP_LIBRARIES}.")
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
+ # also test LOG4CPP; if we have it, use this version of the logger
# otherwise, default to the stdout/stderr model.
- if(LOG4CXX_FOUND)
- SET(HAVE_LOG4CXX True CACHE INTERNAL "" FORCE)
- add_definitions( -DHAVE_LOG4CXX )
- else(LOG4CXX_FOUND)
- SET(HAVE_LOG4CXX False CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE)
- endif(LOG4CXX_FOUND)
+ if(LOG4CPP_FOUND)
+ SET(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE)
+ add_definitions( -DHAVE_LOG4CPP )
+ else(not LOG4CPP_FOUND)
+ SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE)
+ SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
+ SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
+ SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE)
+ endif(LOG4CPP_FOUND)
SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
else(ENABLE_GR_LOG)
- SET(HAVE_LOG4CXX False CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
- SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE)
+ SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE)
+ SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
+ SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
+ SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE)
endif(ENABLE_GR_LOG)
message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
- message(STATUS "HAVE_LOG4CXX set to ${HAVE_LOG4CXX}.")
+ message(STATUS "HAVE_LOG4CPP set to ${HAVE_LOG4CPP}.")
+ message(STATUS "LOG4CPP_LIBRARIES set to ${LOG4CPP_LIBRARIES}.")
endfunction(GR_LOGGING)