diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,10 +56,6 @@ endif() add_definitions(-DQT_NO_URL_CAST_FROM_STRING) -if(BUILD_TESTING) - add_definitions(-DBUILD_TESTING) -endif() - add_subdirectory(src) add_subdirectory(kcm) add_subdirectory(serializers) diff --git a/src/akonadi-contacts/CMakeLists.txt b/src/akonadi-contacts/CMakeLists.txt --- a/src/akonadi-contacts/CMakeLists.txt +++ b/src/akonadi-contacts/CMakeLists.txt @@ -109,7 +109,9 @@ add_library(KF5AkonadiContact ${akonadicontact_LIB_SRC}) - +if (BUILD_TESTING) + target_compile_definitions(KF5AkonadiContact PRIVATE BUILD_TESTING) +endif() generate_export_header(KF5AkonadiContact BASE_NAME akonadi-contact) add_library(KF5::AkonadiContact ALIAS KF5AkonadiContact) diff --git a/src/contact-editor/CMakeLists.txt b/src/contact-editor/CMakeLists.txt --- a/src/contact-editor/CMakeLists.txt +++ b/src/contact-editor/CMakeLists.txt @@ -144,7 +144,9 @@ add_library(KF5ContactEditor ${contacteditor_LIB_SRC}) - +if (BUILD_TESTING) + target_compile_definitions(KF5ContactEditor PRIVATE BUILD_TESTING) +endif() generate_export_header(KF5ContactEditor BASE_NAME contacteditor) add_library(KF5::ContactEditor ALIAS KF5ContactEditor)