Skip to content

Commit

Permalink
cmake: fix logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelld committed Mar 21, 2015
1 parent 985b5ec commit b1e90c8
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Expand Up @@ -98,6 +98,13 @@ if(NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "Python required to compile ieee802_15_4")
endif()

########################################################################
# Setup logging options
########################################################################

include(GrMiscUtils)
GR_LOGGING()

########################################################################
# On Apple only, set install name and use rpath correctly, if not already set
########################################################################
Expand Down Expand Up @@ -126,12 +133,14 @@ include_directories(
${Boost_INCLUDE_DIRS}
${CPPUNIT_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${LOG4CPP_INCLUDE_DIRS}
)

link_directories(
${Boost_LIBRARY_DIRS}
${CPPUNIT_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
${LOG4CPP_LIBRARY_DIRS}
)

set(GR_IEEE802_15_4_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
Expand Down
53 changes: 53 additions & 0 deletions cmake/Modules/FindLog4cpp.cmake
@@ -0,0 +1,53 @@
# - 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
)


if (LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY)
set(LOG4CPP_FOUND TRUE)
set(LOG4CPP_LIBRARIES ${LOG4CPP_LIBRARY} CACHE INTERNAL "" FORCE)
set(LOG4CPP_INCLUDE_DIRS ${LOG4CPP_INCLUDE_DIR} CACHE INTERNAL "" FORCE)
else ()
set(LOG4CPP_FOUND FALSE CACHE INTERNAL "" FORCE)
set(LOG4CPP_LIBRARY "" CACHE INTERNAL "" FORCE)
set(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE)
set(LOG4CPP_INCLUDE_DIR "" CACHE INTERNAL "" FORCE)
set(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
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 ()

mark_as_advanced(
LOG4CPP_LIBRARIES
LOG4CPP_INCLUDE_DIRS
)
1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Expand Up @@ -55,6 +55,7 @@ list(APPEND ieee802_15_4_sources
list(APPEND ieee802_15_4_libs
${Boost_LIBRARIES}
${GNURADIO_ALL_LIBRARIES}
${LOG4CPP_LIBRARIES}
)

add_library(gnuradio-ieee802_15_4 SHARED ${ieee802_15_4_sources})
Expand Down

0 comments on commit b1e90c8

Please sign in to comment.