diff --git c/CMakeLists.txt i/CMakeLists.txt
index 87cebac..ad4aa3c 100644
--- c/CMakeLists.txt
+++ i/CMakeLists.txt
@@ -6,20 +6,24 @@ set(QT_MIN_VERSION "5.6.1")
 set(KF5_MIN_VERSION "5.29.0")
 set(PLASMA_MIN_VERSION "5.4.0")
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTORCC ON)
 
-find_package(ECM 1.0.0 REQUIRED NO_MODULE)
-
 find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
-
 set(CMAKE_MODULE_PATH
         ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
         ${CMAKE_MODULE_PATH}
         ${ECM_MODULE_PATH}
         ${ECM_KDE_MODULE_DIR})
 
+find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets Test)
+find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)
+
+include(GNUInstallDirs)
 include(KDEInstallDirs)
 include(KDECMakeSettings)
 include(KDECompilerSettings NO_POLICY_SCOPE)
@@ -29,3 +33,35 @@ add_subdirectory(src)
 # add_subdirectory(tests)
 add_subdirectory(example)
 
+
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file(
+        ${CMAKE_SOURCE_DIR}/cmake/kImageAnnotator-config.cmake.in
+        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config.cmake
+        INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator
+)
+
+write_basic_package_version_file(
+        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config-version.cmake
+        VERSION ${PROJECT_VERSION}
+        COMPATIBILITY AnyNewerVersion
+)
+
+install(FILES
+        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config.cmake
+        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config-version.cmake
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator
+)
+
+
+export(EXPORT kImageAnnotator-targets
+        FILE ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-targets.cmake
+        NAMESPACE kImageAnnotator::
+)
+
+install(EXPORT kImageAnnotator-targets
+        FILE kImageAnnotator-targets.cmake
+        NAMESPACE kImageAnnotator::
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator
+)
diff --git c/cmake/kImageAnnotator-config.cmake.in i/cmake/kImageAnnotator-config.cmake.in
index 4704939..00c7dd1 100644
--- c/cmake/kImageAnnotator-config.cmake.in
+++ i/cmake/kImageAnnotator-config.cmake.in
@@ -2,10 +2,11 @@ include(CMakeFindDependencyMacro)
 
 @PACKAGE_INIT@
 
-# find_dependency(Threads)
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets)
+find_dependency(ECM @KF5_MIN_VERSION@)
+list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
 
-find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)
+find_dependency(Qt5 @QT_MIN_VERSION@ COMPONENTS Widgets)
+find_dependency(KF5 @KF5_MIN_VERSION@ COMPONENTS CoreAddons I18n WidgetsAddons)
 
 if(NOT TARGET kImageAnnotator::kImageAnnotator)
   include("${CMAKE_CURRENT_LIST_DIR}/kImageAnnotator-targets.cmake")
diff --git c/example/CMakeLists.txt i/example/CMakeLists.txt
index 57c43a0..c96a353 100644
--- c/example/CMakeLists.txt
+++ i/example/CMakeLists.txt
@@ -1,3 +1,3 @@
-add_executable(kImageAnnotator-example ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
+add_executable(kImageAnnotator-example main.cpp)
 
-target_link_libraries(kImageAnnotator-example PRIVATE kImageAnnotator::kImageAnnotator)
\ No newline at end of file
+target_link_libraries(kImageAnnotator-example kImageAnnotator)
diff --git c/include/kImageAnnotator/KImageAnnotator.h i/include/kImageAnnotator/KImageAnnotator.h
index 93eab24..9956276 100644
--- c/include/kImageAnnotator/KImageAnnotator.h
+++ i/include/kImageAnnotator/KImageAnnotator.h
@@ -28,6 +28,8 @@
 
 #include <KLocalizedString>
 
+#include <kImageAnnotatorExport.h>
+
 #include "../../src/gui/VisibilitySwitcher.h"
 #include "../../src/annotations/core/AnnotationArea.h"
 #include "../../src/backend/Config.h"
@@ -36,7 +38,7 @@
 #include "../../src/widgets/SizePicker.h"
 #include "../../src/widgets/FillPicker.h"
 
-class KImageAnnotator : public QWidget
+class KIMAGEANNOTATOR_EXPORT KImageAnnotator : public QWidget
 {
 Q_OBJECT
 public:
diff --git c/include/kImageAnnotator/KImageAnnotatorExport.h i/include/kImageAnnotator/KImageAnnotatorExport.h
new file mode 100644
index 0000000..26e3377
--- /dev/null
+++ i/include/kImageAnnotator/KImageAnnotatorExport.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018 Damir Porobic <damir.porobic@gmx.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if defined KIMAGEANNOTATOR_LIB
+ #define KIMAGEANNOTATOR_EXPORT Q_DECL_EXPORT
+#else
+ #define KIMAGEANNOTATOR_EXPORT Q_DECL_IMPORT
+#endif
diff --git c/src/CMakeLists.txt i/src/CMakeLists.txt
index 70271a2..98057e6 100644
--- c/src/CMakeLists.txt
+++ i/src/CMakeLists.txt
@@ -1,141 +1,89 @@
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets)
-
-find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)
-
 set(kimageannotator_SRCS
-        ${CMAKE_SOURCE_DIR}/src/gui/KImageAnnotator.cpp
-        ${CMAKE_SOURCE_DIR}/src/gui/VisibilitySwitcher.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/core/AnnotationArea.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/core/AnnotationItemFactory.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/core/AnnotationProperties.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/core/AnnotationPropertiesFactory.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/AnnotationItemModifier.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/AnnotationItemResizer.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/AnnotationMultiItemResizer.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/AnnotationItemSelector.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/AnnotationItemMover.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/AnnotationItemArranger.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/AbstractItemResizeHandles.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/AbstractRectResizeHandles.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/LineResizeHandles.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/RectResizeHandles.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/PathResizeHandles.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/ResizeHandle.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/modifiers/resizeHandles/ResizeHandlesFactory.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AbstractAnnotationItem.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AbstractAnnotationLine.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AbstractAnnotationRect.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AbstractAnnotationPath.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AnnotationLine.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AnnotationArrow.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AnnotationRect.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AnnotationEllipse.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AnnotationNumber.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/items/AnnotationPen.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/undo/AddCommand.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/undo/DeleteCommand.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/undo/MoveCommand.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/undo/ResizeCommand.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/undo/ArrangeCommand.cpp
-        ${CMAKE_SOURCE_DIR}/src/annotations/misc/ShadowEffect.cpp
-        ${CMAKE_SOURCE_DIR}/src/backend/Config.cpp
-        ${CMAKE_SOURCE_DIR}/src/common/helper/IconCreater.cpp
-        ${CMAKE_SOURCE_DIR}/src/common/helper/CursorHelper.cpp
-        ${CMAKE_SOURCE_DIR}/src/common/helper/KeyHelper.cpp
-        ${CMAKE_SOURCE_DIR}/src/common/helper/MathHelper.cpp
-        ${CMAKE_SOURCE_DIR}/src/common/helper/ItemHelper.cpp
-        ${CMAKE_SOURCE_DIR}/src/common/helper/ShapeHelper.cpp
-        ${CMAKE_SOURCE_DIR}/src/widgets/ToolPicker.cpp
-        ${CMAKE_SOURCE_DIR}/src/widgets/ColorPicker.cpp
-        ${CMAKE_SOURCE_DIR}/src/widgets/SizePicker.cpp
-        ${CMAKE_SOURCE_DIR}/src/widgets/FillPicker.cpp)
-
-#set(kimageannotator_SRCS ${kimageannotator_SRCS} PARENT_SCOPE)
-#
-#set(kimageannotator_ICON_QRC ${CMAKE_SOURCE_DIR}/icons/resources.qrc)
-#
-#add_executable(kimageannotator_app main.cpp ${kimageannotator_SRCS} ${kimageannotator_ICON_QRC} ${CMAKE_SOURCE_DIR}/include/kImageAnnotator/KImageAnnotator.h)
-#
-#target_include_directories(kimageannotator_app PRIVATE ${CMAKE_SOURCE_DIR}/include)
-#
-#target_link_libraries(kimageannotator_app Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons)
-
-
-add_library(kImageAnnotator ${kimageannotator_SRCS} ${CMAKE_SOURCE_DIR}/include/kImageAnnotator/KImageAnnotator.h)
-
-add_library(kImageAnnotator::kImageAnnotator ALIAS kImageAnnotator)
-
-option(BUILD_SHARED_LIBS "Build shared library" ON)
-include(GenerateExportHeader)
-
-generate_export_header(kImageAnnotator
-        EXPORT_MACRO_NAME KIMAGEANNOTATOR_API
-        EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/include/KImageAnnotator.h
+        gui/KImageAnnotator.cpp
+        gui/VisibilitySwitcher.cpp
+        annotations/core/AnnotationArea.cpp
+        annotations/core/AnnotationItemFactory.cpp
+        annotations/core/AnnotationProperties.cpp
+        annotations/core/AnnotationPropertiesFactory.cpp
+        annotations/modifiers/AnnotationItemModifier.cpp
+        annotations/modifiers/AnnotationItemResizer.cpp
+        annotations/modifiers/AnnotationMultiItemResizer.cpp
+        annotations/modifiers/AnnotationItemSelector.cpp
+        annotations/modifiers/AnnotationItemMover.cpp
+        annotations/modifiers/AnnotationItemArranger.cpp
+        annotations/modifiers/resizeHandles/AbstractItemResizeHandles.cpp
+        annotations/modifiers/resizeHandles/AbstractRectResizeHandles.cpp
+        annotations/modifiers/resizeHandles/LineResizeHandles.cpp
+        annotations/modifiers/resizeHandles/RectResizeHandles.cpp
+        annotations/modifiers/resizeHandles/PathResizeHandles.cpp
+        annotations/modifiers/resizeHandles/ResizeHandle.cpp
+        annotations/modifiers/resizeHandles/ResizeHandlesFactory.cpp
+        annotations/items/AbstractAnnotationItem.cpp
+        annotations/items/AbstractAnnotationLine.cpp
+        annotations/items/AbstractAnnotationRect.cpp
+        annotations/items/AbstractAnnotationPath.cpp
+        annotations/items/AnnotationLine.cpp
+        annotations/items/AnnotationArrow.cpp
+        annotations/items/AnnotationRect.cpp
+        annotations/items/AnnotationEllipse.cpp
+        annotations/items/AnnotationNumber.cpp
+        annotations/items/AnnotationPen.cpp
+        annotations/undo/AddCommand.cpp
+        annotations/undo/DeleteCommand.cpp
+        annotations/undo/MoveCommand.cpp
+        annotations/undo/ResizeCommand.cpp
+        annotations/undo/ArrangeCommand.cpp
+        annotations/misc/ShadowEffect.cpp
+        backend/Config.cpp
+        common/helper/IconCreater.cpp
+        common/helper/CursorHelper.cpp
+        common/helper/KeyHelper.cpp
+        common/helper/MathHelper.cpp
+        common/helper/ItemHelper.cpp
+        common/helper/ShapeHelper.cpp
+        widgets/ToolPicker.cpp
+        widgets/ColorPicker.cpp
+        widgets/SizePicker.cpp
+        widgets/FillPicker.cpp)
+
+
+add_library(kImageAnnotator
+        ${kimageannotator_SRCS}
+        ${CMAKE_SOURCE_DIR}/include/kImageAnnotator/KImageAnnotator.h
         )
+add_library(kImageAnnotator::kImageAnnotator ALIAS kImageAnnotator)
 
 target_include_directories(kImageAnnotator
         PUBLIC
-        $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
+        $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/kImageAnnotator>
         $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
-        $<INSTALL_INTERFACE:include>
-        PRIVATE
-        ${CMAKE_CURRENT_SOURCE_DIR}
+        $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
         )
 
+target_link_libraries(kImageAnnotator PUBLIC
+  Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons
+)
+target_compile_definitions(kImageAnnotator PRIVATE KIMAGEANNOTATOR_LIB)
+
 set_target_properties(kImageAnnotator PROPERTIES
         ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
         LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
         RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
         )
 
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets)
 
-find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)
+# set(kimageannotator_ICON_QRC ${CMAKE_SOURCE_DIR}/icons/resources.qrc)
+# add_executable(kimageannotator_app main.cpp ${kimageannotator_ICON_QRC})
+# target_link_libraries(kimageannotator_app PRIVATE kImageAnnotator)
 
-target_link_libraries(kImageAnnotator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons)
-
-include(GNUInstallDirs)
 
 install(TARGETS kImageAnnotator
         EXPORT kImageAnnotator-targets
         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-        INCLUDES DESTINATION ${LIBLEGACY_INCLUDE_DIRS}
 )
 
 install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/kImageAnnotator
         DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 )
-
-install(EXPORT kImageAnnotator-targets
-        FILE kImageAnnotator-targets.cmake
-        NAMESPACE kImageAnnotator::
-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator
-)
-
-
-include(CMakePackageConfigHelpers)
-
-configure_package_config_file(
-        ${CMAKE_SOURCE_DIR}/cmake/kImageAnnotator-config.cmake.in
-        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config.cmake
-        INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator
-)
-
-write_basic_package_version_file(
-        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config-version.cmake
-        VERSION ${PROJECT_VERSION}
-        COMPATIBILITY AnyNewerVersion
-)
-
-install(FILES
-        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config.cmake
-        ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config-version.cmake
-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator
-)
-
-export(EXPORT kImageAnnotator-targets
-        FILE ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-targets.cmake
-        NAMESPACE kImageAnnotator::
-)
\ No newline at end of file
diff --git c/src/gui/KImageAnnotator.cpp i/src/gui/KImageAnnotator.cpp
index 0805045..3f2d213 100644
--- c/src/gui/KImageAnnotator.cpp
+++ i/src/gui/KImageAnnotator.cpp
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include "../../include/kImageAnnotator/KImageAnnotator.h"
+#include <KImageAnnotator.h>
 
 KImageAnnotator::KImageAnnotator(const QPixmap &image)
 {
diff --git c/tests/CMakeLists.txt i/tests/CMakeLists.txt
index 30b250b..dc23eee 100644
--- c/tests/CMakeLists.txt
+++ i/tests/CMakeLists.txt
@@ -1,41 +1,37 @@
 enable_testing(true)
 
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Test Widgets)
-
-find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)
-
 set(ListOfUnitTests
         annotations/core/AnnotationAreaTest.cpp
-        annotations/core/AnnotationItemFactoryTest
-        annotations/core/AnnotationPropertiesFactoryTest
-        annotations/modifiers/AnnotationItemResizerTest
-        annotations/modifiers/AnnotationMultiItemResizerTest
-        annotations/modifiers/AnnotationItemSelectorTest
-        annotations/modifiers/AnnotationItemModifierTest
-        annotations/modifiers/AnnotationItemArrangerTest
-        annotations/modifiers/AnnotationItemMoverTest
-        annotations/modifiers/resizeHandles/LineResizeHandlesTest
-        annotations/modifiers/resizeHandles/RectResizeHandlesTest
-        annotations/undo/AddCommandTest
-        annotations/undo/DeleteCommandTest
-        annotations/undo/MoveCommandTest
-        annotations/undo/ResizeCommandTest
+        annotations/core/AnnotationItemFactoryTest.cpp
+        annotations/core/AnnotationPropertiesFactoryTest.cpp
+        annotations/modifiers/AnnotationItemResizerTest.cpp
+        annotations/modifiers/AnnotationMultiItemResizerTest.cpp
+        annotations/modifiers/AnnotationItemSelectorTest.cpp
+        annotations/modifiers/AnnotationItemModifierTest.cpp
+        annotations/modifiers/AnnotationItemArrangerTest.cpp
+        annotations/modifiers/AnnotationItemMoverTest.cpp
+        annotations/modifiers/resizeHandles/LineResizeHandlesTest.cpp
+        annotations/modifiers/resizeHandles/RectResizeHandlesTest.cpp
+        annotations/undo/AddCommandTest.cpp
+        annotations/undo/DeleteCommandTest.cpp
+        annotations/undo/MoveCommandTest.cpp
+        annotations/undo/ResizeCommandTest.cpp
         annotations/undo/ArrangeCommandTest.cpp
-        widgets/ToolPickerTest
-        widgets/ColorPickerTest
-        widgets/SizePickerTest
-        widgets/FillPickerTest
-        common/helper/KeyHelperTest
-        common/helper/MathHelperTest
-        common/helper/ItemHelperTest
-        common/helper/ShapeHelperTest)
+        widgets/ToolPickerTest.cpp
+        widgets/ColorPickerTest.cpp
+        widgets/SizePickerTest.cpp
+        widgets/FillPickerTest.cpp
+        common/helper/KeyHelperTest.cpp
+        common/helper/MathHelperTest.cpp
+        common/helper/ItemHelperTest.cpp
+        common/helper/ShapeHelperTest.cpp)
 
-add_library(kimageannotator_LIB STATIC ${kimageannotator_SRCS})
-target_link_libraries(kimageannotator_LIB Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons)
+add_library(kImageAnnotatorStatic STATIC ${kimageannotator_SRCS})
+target_link_libraries(kImageAnnotatorStatic Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons)
 
 foreach (UnitTest ${ListOfUnitTests})
     get_filename_component(UnitTestName ${UnitTest} NAME_WE)
     add_executable(${UnitTestName} ${UnitTest})
-    target_link_libraries(${UnitTestName} Qt5::Test kimageannotator_LIB)
+    target_link_libraries(${UnitTestName} kImageAnnotatorStatic Qt5::Test)
     add_test(${UnitTestName} ${UnitTestName})
 endforeach (UnitTest)
