Best-practise currently for testing internal parts of libs? *_TEST_EXPORT macro?
David Faure
faure at kde.org
Wed Sep 2 09:20:19 UTC 2015
On Monday 31 August 2015 14:41:00 Friedrich W. H. Kossebau wrote:
>
> The only place lxr.kde.org pointed out to use the *TEST_EXPORT approach was
> grantlee, which simply creates a separate file with the define that then is
> appended to the file generated with generate_export_header:
> http://lxr.kde.org/source/grantlee/templates/lib/CMakeLists.txt
Konqueror has a simpler approach, a file that includes the generated file
and adds the tests_export macro on top.
#include "konquerorprivate_export.h"
/* Classes from the Konqueror application, which are exported only for unit tests */
#ifdef COMPILING_TESTS
# ifndef KONQ_TESTS_EXPORT
# define KONQ_TESTS_EXPORT KONQUERORPRIVATE_EXPORT
# endif
#else /* not compiling tests */
# define KONQ_TESTS_EXPORT
#endif
See kde/applications/kde-baseapps/konqueror/src/konqprivate_export.h
branch frameworks.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
More information about the Kde-buildsystem
mailing list