summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-13 15:36:26 -0400
committerTom Rondeau <trondeau@vt.edu>2013-03-13 15:36:26 -0400
commitf2e1c50081e66b7962c707de90378ac9209070bc (patch)
tree2f18af4cbfeba7e1bde9198f987f58817f0e816b /gr-howto-write-a-block
parent890f2882d2210b1d4e64f0bbffc42ccc716cfd97 (diff)
log: replacing log4cxx with log4cpp.
Diffstat (limited to 'gr-howto-write-a-block')
-rw-r--r--gr-howto-write-a-block/CMakeLists.txt4
-rw-r--r--gr-howto-write-a-block/cmake/Modules/FindLog4cpp.cmake58
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake32
-rw-r--r--gr-howto-write-a-block/lib/CMakeLists.txt2
4 files changed, 77 insertions, 19 deletions
diff --git a/gr-howto-write-a-block/CMakeLists.txt b/gr-howto-write-a-block/CMakeLists.txt
index d5d04e24d0..1a9f403dd2 100644
--- a/gr-howto-write-a-block/CMakeLists.txt
+++ b/gr-howto-write-a-block/CMakeLists.txt
@@ -105,14 +105,14 @@ include_directories(
${CMAKE_SOURCE_DIR}/include
${GNURADIO_CORE_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
- ${LOG4CXX_INCLUDE_DIRS}
+ ${LOG4CPP_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
link_directories(
${GNURADIO_CORE_LIBRARY_DIRS}
${GRUEL_LIBRARY_DIRS}
- ${LOG4CXX_LIBRARY_DIRS}
+ ${LOG4CPP_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS}
)
diff --git a/gr-howto-write-a-block/cmake/Modules/FindLog4cpp.cmake b/gr-howto-write-a-block/cmake/Modules/FindLog4cpp.cmake
new file mode 100644
index 0000000000..0b7208630f
--- /dev/null
+++ b/gr-howto-write-a-block/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/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
index 685ac3c879..876e71687f 100644
--- a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
@@ -219,35 +219,35 @@ endfunction(GR_GEN_TARGET_DEPS)
# Can manually set with -DENABLE_GR_LOG=0|1
########################################################################
function(GR_LOGGING)
- find_package(Log4cxx)
+ find_package(Log4cpp)
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)
- 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)
+ if(LOG4CPP_FOUND)
+ SET(HAVE_LOG4CPP True)
+ add_definitions( -DHAVE_LOG4CPP )
+ else(LOG4CPP_FOUND)
+ SET(HAVE_LOG4CPP False)
+ SET(LOG4CPP_INCLUDE_DIRS "")
+ SET(LOG4CPP_LIBRARY_DIRS "")
+ SET(LOG4CPP_LIBRARIES "")
+ endif(LOG4CPP_FOUND)
SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
else(ENABLE_GR_LOG)
- SET(HAVE_LOG4CXX False)
- SET(LOG4CXX_INCLUDE_DIRS)
- SET(LOG4CXX_LIBRARY_DIRS)
- SET(LOG4CXX_LIBRARIES)
+ SET(HAVE_LOG4CPP False)
+ SET(LOG4CPP_INCLUDE_DIRS)
+ SET(LOG4CPP_LIBRARY_DIRS)
+ SET(LOG4CPP_LIBRARIES)
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}.")
endfunction(GR_LOGGING)
diff --git a/gr-howto-write-a-block/lib/CMakeLists.txt b/gr-howto-write-a-block/lib/CMakeLists.txt
index a55bb1fa4a..dee02f08c7 100644
--- a/gr-howto-write-a-block/lib/CMakeLists.txt
+++ b/gr-howto-write-a-block/lib/CMakeLists.txt
@@ -27,7 +27,7 @@ target_link_libraries(gnuradio-howto
${Boost_LIBRARIES}
${GRUEL_LIBRARIES}
${GNURADIO_CORE_LIBRARIES}
- ${LOG4CXX_LIBRARIES})
+ ${LOG4CPP_LIBRARIES})
set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS")
########################################################################