This repository has been archived on 2025-12-24. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
yachat/qcm/tests.qcm
2025-12-25 01:38:25 +05:00

63 lines
1.5 KiB
Text

/*
-----BEGIN QCMOD-----
name: Tests
arg: with-cppunit-inc=[path],Path to CppUnit include files
arg: with-cppunit-lib=[path],Path to CppUnit library files
-----END QCMOD-----
*/
//----------------------------------------------------------------------------
// qc_tests
//----------------------------------------------------------------------------
class qc_tests : public ConfObj
{
public:
qc_tests(Conf *c) : ConfObj(c) {}
QString name() const { return "tests"; }
QString shortname() const { return "tests"; }
bool exec()
{
QString s = conf->getenv("QC_WITH_CPPUNIT_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "cppunit/Test.h")) {
conf->debug("CppUnit includes not found!");
return false;
}
conf->addIncludePath(s);
}
else {
QStringList sl;
sl += "/usr/include";
sl += "/usr/local/include";
sl += "/sw/include";
sl += "/opt/local/include";
if(!conf->findHeader("cppunit/Test.h", sl, &s)) {
conf->debug("CppUnit includes not found!");
return false;
}
conf->addIncludePath(s);
}
s = conf->getenv("QC_WITH_CPPUNIT_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "cppunit")) {
conf->debug("CppUnit libraries not found!");
return false;
}
conf->addLib(QString("-L") + s);
}
else {
if(!conf->findLibrary("cppunit", &s)) {
conf->debug("CppUnit libraries not found!");
return false;
}
if (!s.isEmpty())
conf->addLib(QString("-L") + s);
}
conf->addLib("-lcppunit");
conf->addExtra("CONFIG += tests");
return true;
}
};