1

I need to use log4cpp in my project and I'd like to add this library as biicode block.

I read the documentation and tried to prepare the library for biicode.

I get the source of log4cpp from sourceforge's git here. log4cpp already has CMakeLists.txt, but when I tried to compile it with cmake on ubuntu linux, there was error: missing file log4cpp/config.h.

Apparently, log4cpp is autotools-based project and needs to run ./autogen.sh and then ./configure to prepare project for compilation on Ubuntu linux. When I called this commands, log4cpp/config.h file is appeared and I was able to compile project with cmake.

Then I added this code to CMakeLists.txt:

if (BIICODE)
    include(biicode.cmake)
    return()
endif()

and in biicode.cmake I added this code:

# remove tests targets
LIST(REMOVE_ITEM BII_BLOCK_EXES tests_testCategory tests_testConfig tests_testDLL tests_testDailyRollingFileAppender tests_testErrorCollision tests_testFilter tests_testFixedContextCategory tests_testNDC tests_testNDCMain tests_testNTEventLog tests_testPattern tests_testPriority tests_testPropConfig tests_testProperties tests_testPropertyConfig tests_testRollingFileAppender tests_test_convenience tests_testbench tests_testmain)

# remove unnecessary files from lib
LIST(REMOVE_ITEM BII_LIB_SRC
    tests/Clock.cpp
    tests/Clock.hh
    tests/NDCTest.hh
)

ADD_BII_TARGETS()

Now I was able to build block with bii build. But when I published this block to biicode and tried to use it in other sample project, when I run bii find, biicode download log4cpp, but not all sources (for example, RollingFileAppender.cpp is not available after downloading).

My sample project that use log4cpp:

#include "log4cpp/Category.hh"

int main()
{
    log4cpp::Category::getInstance("application");
    return 0;
}

And I was need to add this section to biicode.conf file of sample project:

[includes]
    log4cpp/*: halex2005/log4cpp/include

So, my questions is:

  • How I can prepare autotools-based project to be the biicode block in right way?
  • How to run ./auto-gen.sh and ./configure on bii configure command?
  • How to force biicode to download full list of sources for biicode block?

Thanks in advance!

2
  • Do you have a fork of the git repo with all those changes, so I could have a look and play a bit with it? In any case, the question is maybe more related to the build system of CMake, and how it can handle autotools, that to biicode, that just uses CMake. Maybe look: stackoverflow.com/questions/5971921/… If you have that fork, please tell me and I'll check it.
    – drodri
    May 8, 2015 at 8:11
  • Using ExternalProject_Add is interesting, I think I should try this approach. For now I published git repo here: github.com/halex2005/log4cpp.
    – hal
    May 9, 2015 at 19:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.