From 154565a4a5f5409653fe82e9fb405832dad4b93e Mon Sep 17 00:00:00 2001 From: Philippe Hamelin Date: Fri, 15 Apr 2011 16:15:31 -0400 Subject: [PATCH 3/3] win32: fix linking with log4cpp in debug mode. --- config/FindLog4cpp.cmake | 10 +++++++++- logging/CMakeLists.txt | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config/FindLog4cpp.cmake b/config/FindLog4cpp.cmake index 6d6e0ec..a45a1f2 100644 --- a/config/FindLog4cpp.cmake +++ b/config/FindLog4cpp.cmake @@ -31,6 +31,7 @@ ENDIF () # Find headers and libraries find_path(LOG4CPP_INCLUDE_DIR NAMES log4cpp/Category.hh ${LOG4CPP_INCLUDE_HINTS}) find_library(LOG4CPP_LIBRARY NAMES log4cpp ${LOG4CPP_LIBRARY_HINTS}) +find_library(LOG4CPPD_LIBRARY NAMES log4cpp${CMAKE_DEBUG_POSTFIX} ${LOG4CPP_LIBRARY_HINTS}) set(LOG4CPP_VERSION 6.0.0) message("Log4cpp version to look for: ${LOG4CPP_VERSION} (hard-coded in FindLog4cpp.cmake).") @@ -60,7 +61,14 @@ if(LOG4CPP_FOUND) set(LOG4CPP_INCLUDE_DIRS ${LOG4CPP_INCLUDE_DIR}) # Libraries - set(LOG4CPP_LIBRARIES ${LOG4CPP_LIBRARY}) + if(LOG4CPP_LIBRARY) + set(LOG4CPP_LIBRARIES optimized ${LOG4CPP_LIBRARY}) + else(LOG4CPP_LIBRARY) + set(LOG4CPP_LIBRARIES "") + endif(LOG4CPP_LIBRARY) + if(LOG4CPPD_LIBRARY) + set(LOG4CPP_LIBRARIES debug ${LOG4CPPD_LIBRARY} ${LOG4CPP_LIBRARIES}) + endif(LOG4CPPD_LIBRARY) # Link dirs get_filename_component(LOG4CPP_LIBRARY_DIRS ${LOG4CPP_LIBRARY} PATH) diff --git a/logging/CMakeLists.txt b/logging/CMakeLists.txt index a54bc46..3c3a86a 100644 --- a/logging/CMakeLists.txt +++ b/logging/CMakeLists.txt @@ -18,8 +18,8 @@ IF ( BUILD_LOGGING AND LOG4CPP_FOUND ) orocos_library( orocos-ocl-log4cpp ${LOGLIB_CPPS} ) orocos_install_headers( ${HPPS} INSTALL include/orocos/ocl ) - target_link_libraries( orocos-ocl-log4cpp "${LOG4CPP_LIBRARIES}") - target_link_libraries( orocos-ocl-logging "${LOG4CPP_LIBRARIES}" orocos-ocl-log4cpp) + target_link_libraries( orocos-ocl-log4cpp ${LOG4CPP_LIBRARIES}) + target_link_libraries( orocos-ocl-logging ${LOG4CPP_LIBRARIES} orocos-ocl-log4cpp) orocos_generate_package() ADD_SUBDIRECTORY( tests ) -- 1.7.0.4