[CMake] A problem about linking libraries

Fang-Chuan Wu wfc93 at cs.ccu.edu.tw
Tue Apr 26 00:01:58 EDT 2005


Hi all,

I have a problem about linking libraries.

In my program, I have to use the Cppunit library.

The content of the CMakeLists.txt is below.

---
PROJECT(testing)

ADD_EXECUTABLE(main main.cpp HelloCPPUnitTest.cpp )

FIND_LIBRARY(CPPUNIT_LIBARY NAMES cppunit
PATHS /usr/lib /usr/local/lib)
IF (CPPUNIT_LIBRARY)
ADD_LIBRARY(CPPUNIT_LIBRARY)
LINK_LIBRARIES(cppunit)
ENDIF (CPPUNIT_LIBRARY)
--

When I build my program, there are lots of linking errors. Then I
checked the Makefile,and it did not appear "-lcppunit".

How to correct the CMakeLists.txt?

Thanks in advance.

Best regards,
Benny



More information about the CMake mailing list