--- CMakeLists.txt.orig +++ CMakeLists.txt @@ -134,6 +134,19 @@ find_package(PythonLibs 2) find_package(SWIG) +# Handle gr_log enable/disable +include(GrMiscUtils) +GR_LOGGING() +# use gr_log iff enabled and log4cpp found +if(ENABLE_GR_LOG AND HAVE_LOG4CPP) + set(ENABLE_LOGGING True CACHE INTERNAL "" FORCE) +else() + # when disabled, set all log variables to false, just in case + set(HAVE_GR_LOG False CACHE INTERNAL "" FORCE) + set(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) + set(ENABLE_LOGGING False CACHE INTERNAL "" FORCE) +endif() + ######################################################################## # Setup the components ######################################################################## --- lib/CMakeLists.txt.orig +++ lib/CMakeLists.txt @@ -70,6 +70,11 @@ if(ENABLE_QT) include_directories(${QT_INCLUDE_DIRS}) endif(ENABLE_QT) +if(ENABLE_LOGGING) + include_directories(${LOG4CPP_INCLUDE_DIRS}) + link_directories(${LOG4CPP_LIBRARY_DIRS}) +endif(ENABLE_LOGGING) + list(APPEND fosphor_sources fosphor/axis.c fosphor/cl.c @@ -101,6 +106,7 @@ list(APPEND fosphor_libraries list_cond_append(ENABLE_PYTHON fosphor_libraries ${PYTHON_LIBRARY}) list_cond_append(ENABLE_GLFW fosphor_libraries ${GLFW3_LIBRARIES}) list_cond_append(ENABLE_QT fosphor_libraries ${QT_LIBRARIES}) +list_cond_append(ENABLE_LOGGING fosphor_libraries ${LOG4CPP_LIBRARIES}) add_library(gnuradio-fosphor SHARED ${fosphor_sources}) target_link_libraries(gnuradio-fosphor ${fosphor_libraries})