I created a similar log4cxx-config.cmake file for cross-compiling mingw. Should be similar for what you need to do here.
set(LOG4CXX_VERSION 0.10.0)
get_filename_component(LOG4CXX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(LOG4CXX_INCLUDE_DIR "${LOG4CXX_CMAKE_DIR}/../../../include" CACHE FILEPATH "Log4cxx include directory")
set(LOG4CXX_INCLUDE_DIRS "${LOG4CXX_INCLUDE_DIR}")
set(LOG4CXX_LIBRARY_DIRS "${LOG4CXX_CMAKE_DIR}/../../../lib")
set(LOG4CXX_LIBRARIES "log4cxx;aprutil-1;iconv;expat;apr-1;rpcrt4;shell32;ws2_32;advapi32;kernel32;msvcrt")
I installed this into SYSROOT/share/cmake/log4cxx/log4cxx-config.cmake
. The only real difference should be your library list which can be quite a bit smaller if linking to shared libraries (I was using static where you need to link to the whole chain of dependencies).
Originally posted by Daniel Stonier with karma: 3170 on 2012-05-09
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by daniel_maier on 2012-05-09:
Thanks! I have my log4cxx library outside the SYSROOT directory, and placed the log4cxx-config.cmake accordingly. Yet, the rosconsole CMakeLists.txt does not respect LOG4CXX_LIBRARY_DIRS and LOG4CXX_INCLUDE_DIRS, so I added link_directories and include_directories commands. Now it compiles rosconsole.o but failes to link against log4cxx, because the -L options is missing in the linker command (using make VERBOSE=1).
Comment by Daniel Stonier on 2012-05-10:
Just curious, does your rosconsole CMakeLists.txt have this update? That was done the same time I started using the log4cxx-config above, but it is only a recent addition (03/20/12).
Comment by Daniel Stonier on 2012-05-10:
You might also want to use CMAKE_PREFIX_PATH variable to help your system find the log4cxx-config.cmake if it is outside your sysroot.
Comment by daniel_maier on 2012-05-10:
It has the update from your link. I tried CMAKE_PREFIX_PATH and Log4cxx_DIR, both yielding the same results. CMake seems to ignore the link_directories command.. Anyways, I find the missing include_directories, link_directories command and the missing log4cxx-config.cmake to be a bug in ROS, right?
Comment by Daniel Stonier on 2012-05-10:
log4cxx-config.cmake : that would be part of the log4cxx package (like pkgconfig), so not really ros' problem. I'd like to update eros_log4cxx later to do that properly. You're right about the LOG4CXX_LIBRARY_DIRS and LOG4CXX_INCLUDE DIRS though - it really should use that information.
Comment by Daniel Stonier on 2012-05-10:
Can you make a patch for rosconsole/CMakeLists.txt?