Drop some unneeded lines from test/CMakeLists.txt. Most of the variables
are inherited from the main CMakeLists.txt file. This reduces the amount
of duplicated code and the likelyhood that the two CMakeLists.txt files
get out of sync.
This fixes the following issues when building the unit tests
(related to mixing Qt4 and Qt5 apparently):
[ 69%] Building CXX object CMakeFiles/pulseview.dir/signalhandler.cpp.o
[...]/test/__/pv/moc_sigsession.cxx:13:2:
error: #error "This file was generated using the moc from 4.8.6. It"
#error "This file was generated using the moc from 4.8.6. It"
^
[...]/test/__/pv/moc_sigsession.cxx:14:2:
error: #error "cannot be used with the include files from this version of Qt."
#error "cannot be used with the include files from this version of Qt."
^
[...]/test/__/pv/moc_sigsession.cxx:15:2:
error: #error "(The moc has changed too much.)"
#error "(The moc has changed too much.)"
^
[...]/test/__/pv/moc_sigsession.cxx:64:7:
error: ‘QMetaObjectExtraData’ does not name a type
const QMetaObjectExtraData pv::SigSession::staticMetaObjectExtraData = {
^
[...]/test/__/pv/moc_sigsession.cxx:70:37:
error: ‘staticMetaObjectExtraData’ was not declared in this scope
qt_meta_data_pv__SigSession, &staticMetaObjectExtraData }
^
[...]/test/__/pv/moc_sigsession.cxx:
In member function ‘virtual const QMetaObject* pv::SigSession::metaObject() const’:
[...]/test/__/pv/moc_sigsession.cxx:79:71:
error: conditional expression between distinct pointer types
‘QDynamicMetaObjectData*’ and ‘const QMetaObject*’ lacks a cast
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
^
[...]/test/__/pv/moc_sigsession.cxx:80:1:
warning: control reaches end of non-void function [-Wreturn-type]
}
^
test/CMakeFiles/pulseview-test.dir/build.make:1362: recipe for target
'test/CMakeFiles/pulseview-test.dir/__/pv/moc_sigsession.cxx.o' failed
make[2]: ***
[test/CMakeFiles/pulseview-test.dir/__/pv/moc_sigsession.cxx.o] Error 1
CMakeFiles/Makefile2:110: recipe for target
'test/CMakeFiles/pulseview-test.dir/all' failed
make[1]: *** [test/CMakeFiles/pulseview-test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
On Windows/MinGW we need to use Boost's 'thread_win32' instead of
'thread' (was already done in the main CMakeLists.txt, but not yet
in test/CMakeLists.txt).
The current requirement is 1.42, the 1.46 in test/CMakeLists.txt is a
copy-paste error. This was noticed since OpenBSD currently ships 1.42
and the tests would not build there.
find_package(Boost ...) was missing the "thread" entry, which caused
linking to fail in some situations.
[100%] Building CXX object test/CMakeFiles/pulseview-test.dir/__/pv/widgets/moc_wellarray.cxx.o
Linking CXX executable pulseview-test
CMakeFiles/pulseview-test.dir/__/pv/sigsession.cpp.o: In function `pv::SigSession::SigSession(pv::DeviceManager&)':
sigsession.cpp:(.text+0xfa): undefined reference to `boost:🧵:thread()'
[....]
<libsigrokdecode/libsigrokdecode.h> should be included first (as the
comment says), otherwise a warning can be the result (error in this
case due to -Werror usage):
[ 90%] Building CXX object test/CMakeFiles/pulseview-test.dir/data/decoder.cpp.o
In file included from /usr/include/python3.2mu/Python.h:8:0,
from [....]/include/libsigrokdecode/libsigrokdecode.h:25,
from [....]/test/data/decoder.cpp:23:
/usr/include/python3.2mu/pyconfig.h:1182:0: error: "_POSIX_C_SOURCE" redefined [-Werror]
#define _POSIX_C_SOURCE 200112L
^
The details of the test are explained in-source. This test is designed to
provide a test case for bug 33.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
-DBOOST_TEST_DYN_LINK is meant to be passed only to pulseview-test,
not to pulseview. When test were enabled, this flag was defined
globally, and as a result, also passed to pulseview.
Create a CMakeLists.txt for test, and add test as a subdirectory
when tests are enabled. This way, -DBOOST_TEST_DYN_LINK is only
defined for our test app.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>