Unit tests do not build with CMake and out of source build
[ 66%] Building CXX object samples/CMakeFiles/addmoddel.dir/addmoddel.cpp.o cd /home/languitar/workspace/build/exiv2/samples && /usr/bin/c++ -DEXV_HAVE_DLL -DEXV_LOCALEDIR=/home/languitar/vol/digikam/share/locale -DEXV_HAVE_STDINT_H -g -I/home/languitar/workspace/build/exiv2 -I/home/languitar/workspace/exiv2/xmpsdk/include -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -o CMakeFiles/addmoddel.dir/addmoddel.cpp.o -c /home/languitar/workspace/exiv2/samples/addmoddel.cpp /home/languitar/workspace/exiv2/samples/addmoddel.cpp:5:27: fatal error: exiv2/exiv2.hpp: No such file or directory compilation terminated.
The unit tests should make use of the headers from the source folder instead of an installed version (which is currently not installed on my computer, hence it fails). Or is there any good reason why this is not the case? Other wise I could easily generate a patch for this.
Updated by Andreas Huggel almost 10 years ago
It's important that the samples are built against the installed exiv2. That's part of the test. That way it tests pkgconfig and some other obscure issues. Last time I looked, I didn't quite see how to best do this with cmake, so if you can, yes, a patch would be most welcome.
Regards from the Coding Sprint @ Aix-en-Provence :)
Updated by Johannes Wienke almost 10 years ago
Hm, I don't really agree to build unit tests against an installed version. Normally you want to use unit tests to check if installing a version is safe. I would propose to build the unit tests in the first instance against the code from the build folder and add a custom target like "postinstallcheck" that builds them against the installed version if desired. To support this a good pattern is to have the same folder structure for include files in the project as the headers are installed later on. Hence something like exiv2project/src/exiv2/xyz.cpp would make building tests easier.
Updated by Robin Mills about 8 years ago
- Category set to build
- Target version set to 0.24
- % Done changed from 0 to 50
I've submitted changes to build exiv2 with MSVC: SVN:2746 (see Bug #536). I've modified the default configuration of CMakeLists.txt to build the sample applications. The build can be tested for Linux (and Mac) with:
mkdir build ; cd build
cp -R ../test test
cd test ; make test
This runs the suite against the build you have just created. The script test/testMSVC.sh can be used to run the suite on MSVC builds from CygWin or MinGW.
I have not yet investigated "out of source" builds.
Updated by Robin Mills almost 8 years ago
- Status changed from Assigned to Resolved
- % Done changed from 50 to 100
I've submitted a fix for this. SVN:2890 http://dev.exiv2.org/projects/exiv2/repository/revisions/2889
I put a symlink into the build-directory (and his children samples and po) exiv2 -> <exivdir>/src.