Commit 73d97fda authored by David Faure's avatar David Faure

Add export macro for private classes with unittest.

Summary:
Otherwise I get
    undefined reference to `vtable for MailCommon::KMFilterAccountList'
when linking filteractionmissingaccountdialogtest.
Must be a consequence of the recent changes in cmake git (autogen feature).

There are a ton more files that are included directly rather than the
classes being exported though (which can make refactorings harder, e.g.
when new cpp files are added as dependencies of the existing ones,
suddenly it becomes complex to know what to compile in).

Should we go fully in the direction of exporting the stuff we need
when building tests, and compiling these cpp files only once, as a result?

Test Plan: Now it builds with clang

Reviewers: mlaurent, ervin, dvratil

Reviewed By: dvratil

Subscribers: #kde_pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D4708
parent f58df7c0
......@@ -4,6 +4,9 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libmailcommon\")
#add_definitions( -DQT_NO_CAST_FROM_ASCII )
#add_definitions( -DQT_NO_CAST_TO_ASCII )
if(BUILD_TESTING)
add_definitions(-DBUILD_TESTING)
endif(BUILD_TESTING)
set(libmailcommon_filter_SRCS
filter/kmfilteraccountlist.cpp
......
......@@ -112,7 +112,6 @@ add_mailcommon_filter_test(filteractionplaysoundtest
../filteractions/filteractionplaysound.cpp
../soundtestwidget.cpp
../dialog/filteractionmissingsoundurldialog.cpp
../kmfilteraccountlist.cpp
${filter_common_SRCS}
)
......@@ -167,7 +166,6 @@ add_mailcommon_filter_test(filteractionforwardtest
../filteractions/filteractionwithaddress.cpp
../filteractions/filteractionwithstring.cpp
../dialog/filteractionmissingtemplatedialog.cpp
../kmfilteraccountlist.cpp
${filter_common_SRCS}
)
......@@ -210,7 +208,6 @@ add_mailcommon_filter_test(filteractionsettransporttest
filteractionsettransporttest.cpp
../filteractions/filteractionsettransport.cpp
../dialog/filteractionmissingtransportdialog.cpp
../kmfilteraccountlist.cpp
${filter_common_SRCS}
)
......@@ -243,7 +240,6 @@ add_mailcommon_filter_test(filteractionmissingtransportdialogtest
add_mailcommon_filter_test(filteractionmissingaccountdialogtest
filteractionmissingaccountdialogtest.cpp
../dialog/filteractionmissingaccountdialog.cpp
../../filter/kmfilteraccountlist.cpp
)
add_mailcommon_filter_test(filteractionmissingtagdialogtest
......
......@@ -17,11 +17,15 @@
#ifndef KMFILTERACCOUNTLIST_H
#define KMFILTERACCOUNTLIST_H
#include <QTreeWidget>
#include "mailcommon_private_export.h"
namespace MailCommon
{
class MailFilter;
class KMFilterAccountList : public QTreeWidget
class MAILCOMMON_TESTS_EXPORT KMFilterAccountList : public QTreeWidget
{
Q_OBJECT
public:
......
/* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef MAILCOMMONPRIVATE_EXPORT_H
#define MAILCOMMONPRIVATE_EXPORT_H
#include "mailcommon_export.h"
/* Classes which are exported only for unit tests */
#ifdef BUILD_TESTING
# ifndef MAILCOMMON_TESTS_EXPORT
# define MAILCOMMON_TESTS_EXPORT MAILCOMMON_EXPORT
# endif
#else /* not compiling tests */
# define MAILCOMMON_TESTS_EXPORT
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment