[CMake] PKG_CHECK_MODULES cppunit

Michael Bowerman michael.bowerman at gmail.com
Sat May 17 10:28:10 EDT 2008


List,

I am trying to use cppunit for my automated tests.  I have the project
compiling with autotools.  But, I am moving to cmake to build on windows
(while the project is still small-ish).

So, is the proper way to look for CppUnit to use pkg_check_modules?

cppunit exists in /usr/include/cppunit/, which is included via "#include
<cppunit/$HEADER_HERE>.  So, the headers should be found in the normal
system path.

However, the libraries need to be linked with -lcppunit.  I get this error
whent pkg_check_modules is run.  Also, the messages are empty:
CMake Error in tests/Dom/common/CMakeLists.txt:
  Cannot find source file "cppunit".  Tried extensions .c .C .c++ .cc .cpp
  .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

If I run pkg-config cppunit --libs from the command line, I get: -lcppunit.
I can also run cppunit-config --libs successfully.

Any help would be appreciated.  I couldn't find much info searching, and
most of what I found seems to be a little old.

_bowerman

INCLUDE(FindPkgConfig)

PKG_CHECK_MODULES(CPPUNIT REQUIRED cppunit )
MESSAGE( "CPPUNIT_INCLUDE_DIRS : ${CPPUNIT_INCLUDE_DIRS}" )
MESSAGE( "CPPUNIT_LIBRARY_DIRS : ${CPPUNIT_LIBRARY_DIRS}" )
MESSAGE( "CPPUNIT_LIBRARIES : ${CPPUNIT_LIBRARIES}" )


#IF( CPPUNIT_FOUND AND BUILD_TESTS )
  ENABLE_TESTING()
  ADD_SUBDIRECTORY( Inf )
  ADD_SUBDIRECTORY( Dom )
#ENDIF( CPPUNIT_FOUND AND BUILD_TESTS )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080517/a7c9f16a/attachment-0001.htm>


More information about the CMake mailing list