if (WIN32)
  if (CMAKE_BUILD_TYPE STREQUAL Debug) 
    set(LIB_SUF "d")
  else (CMAKE_BUILD_TYPE STREQUAL Debug) 
    set(LIB_SUF "")
  endif (CMAKE_BUILD_TYPE STREQUAL Debug) 
else (WIN32) 
  set(LIB_SUF "")
endif (WIN32)

FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h
  /usr/local/include
  /usr/include
)

FIND_LIBRARY(CPPUNIT_LIBRARY cppunit${LIB_SUF} PATHS
  /usr/local/lib
  /usr/lib
)

IF(CPPUNIT_INCLUDE_DIR)
  IF(CPPUNIT_LIBRARY)
    SET(CPPUNIT_FOUND 1)
    SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
    message(STATUS "Found cppunit: ${CPPUNIT_LIBRARY}")
  ELSEIF(CPPUNIT_LIBRARY)
    SET(CPPUNIT_FOUND 0)
    message(STATUS "Not found cppunit: ${CPPUNIT_LIBRARY}")
  ENDIF(CPPUNIT_LIBRARY)
ENDIF(CPPUNIT_INCLUDE_DIR)

#MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARY)


