= How to build CppUnit with Eclipse =

These instructions describe how to build CppUnit with Eclipse 3.1.1, CDT 3.0.1 under Windows XP using MinGW. The steps to build it with WinXP/Cygwin or under Linux should be very similar, although I haven't tested it.

1. Download the CppUnit distribution file cppunit-1.10.2.tar.gz and unpack it in a directory of your choice. From now on we will refer to this directory as $CppUnit .

2. Run MSys to open a command line shell, then cd to the directory where you extracted CppUnit and do:

./configure

There's no need to go any further than this with make, make install, etc. All we will need is the header $CppUnit/include/cppunit/config-auto.h which has been generated in the step above.

3. Go to Eclipse and create a Managed Make C++ Project to generate a library (either static or shared).

4. Import all .h and .cpp files in $CppUnit/src/cppunit to the project.

5. Open the project properties configuration dialog (Alt + Enter) and add $CppUnit/include to the include path.

(screenshot 1)

6. If you're building a shared library you'll also need to define the variable CPPUNIT_DLL_BUILD.

(screenshot 2)

7. Finally, build the project (Ctrl + B).

8. Now let's create a sample project to test our library.
   Create a new Managed Make C++ Project to generate an executable and import the contents of *this file* into it.
   In the project properties configuration dialog:
      1. Add $CppUnit/include to the include path.
      2. Add the CppUnit library to the project (see screenshot below).
      3. If you've build CppUnit as a shared library you'll also need to define the variable CPPUNIT_DLL.

(screenshot 3)
Note that in my system the generated library is at "C:\home_Alex\projetos_eclipse\CppUnit2\Release\CppUnit.dll".

9. By running the executable you'll find out that all tests will pass. You may now play around and introduce errors in the Complex class methods to see CppUnit's diagnostic error messages when a test fails.

10. (optional) The compiler issues several warning messages of ignored pragmas in the CppUnit source. You may edit the source headers and comment those lines if you don't want to be bothered by these warnings in your projects.
