For the library itself, I have standard build settings : a Debug
and a Release
target, with the -fPIC
compile option, an artifact type Shared Library
, extension so
and prefix lib
, and the -share
linker option.
For the test program, I have added in the same project a main.cpp file:
#ifdef TEST_
#include <cstdlib>
#include <iostream>
#include "config.h"
using namespace std;
int main(int argc, char **argv) {
cout << "Test for project utils" << endl;
return 0;
}
#endif /* TEST_ */
I have added a specific Test
target copied from the DEBUG
one and adapted for standard executable build settings : suppress the -fPIC
compile option, add -D TEST_
, modify the artifact type to Executable
, supress extension so
and prefix lib
, suppress the -share
option for the linker.
Now, just build Debug, Release, and Test as normal, what can be done independently. The Test
target could be easily changed for say Test-Debug
and Test-Release
, to get a library self-test runned just after installation.