Building Examples and Running Tests

Once you’ve installed the appropriate software, you can build any of the example versions and subsequently execute tests. From within an example version directory, you’ll first use CMake to create a makefile.

 
mkdir build
 
cd build
 
cmake ..

The legacy codebase (see Chapter 8, Legacy Challenges) uses libraries from Boost, not just headers. CMakeLists.txt uses the BOOST_ROOT environment variable you defined twice: first, explicitly, by include_directories to indicate where Boost headers can be found, and second, implicitly, when CMake executes find_package to locate Boost libraries.

When building the legacy codebase, you might receive an error indicating that Boost cannot be found. If so, you can experiment with changing the location by passing a value for BOOST_ROOT when you execute CMake.

 
cmake -DBOOST_ROOT=/home/jeff/boost_1_53_0 ..

Otherwise, ensure that you have built the Boost libraries correctly.

Once you have created a make file using CMake, you can build an example by navigating into the example’s build directory and then executing the following:

 
make

To execute tests, navigate into the example’s build directory and then execute the following:

 
./test

For the library example in Chapter 7, Quality Tests, you will find the test executable in build/libraryTests.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.29.71