Commit 79164ca8 authored by Nicolas Fella's avatar Nicolas Fella

Replace manual include dir handling with interface target

We use kdeconnect-version.h in several places and therefore it needs to be in the include path. We currently do this by setting target_include_path in a few places. Replace this with an interface library that we can link against that sets up the correct include path. IMO it is cleaner this way.
parent e2e303d7
Pipeline #29227 passed with stage
in 16 minutes and 11 seconds
......@@ -34,6 +34,10 @@ ecm_setup_version(1.4.0
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kdeconnect-version.h
)
# Make the version header available by linking against kdeconnectversion
add_library(kdeconnectversion INTERFACE)
target_include_directories(kdeconnectversion INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
if (SAILFISHOS)
set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config)
set(KF5_OPTIONAL_COMPONENTS)
......
......@@ -3,11 +3,10 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdeconnect-cli\")
add_executable(kdeconnect-cli kdeconnect-cli.cpp)
ecm_mark_nongui_executable(kdeconnect-cli)
target_include_directories(kdeconnect-cli PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(kdeconnect-cli
kdeconnectinterfaces
kdeconnectcore
kdeconnectversion
KF5::CoreAddons
KF5::I18n
)
......
......@@ -52,7 +52,7 @@ set(kdeconnectcore_SRCS
add_library(kdeconnectcore ${kdeconnectcore_SRCS})
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
target_include_directories(kdeconnectcore PUBLIC ${PROJECT_SOURCE_DIR})
target_link_libraries(kdeconnectcore
PUBLIC
......
......@@ -8,8 +8,7 @@ ecm_qt_declare_logging_category(
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (daemon)")
add_executable(kdeconnectd kdeconnectd.cpp ${debug_file_SRCS})
target_include_directories(kdeconnectd PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(kdeconnectd kdeconnectcore KF5::KIOWidgets KF5::DBusAddons KF5::Notifications KF5::I18n Qt5::Widgets)
target_link_libraries(kdeconnectd kdeconnectcore kdeconnectversion KF5::KIOWidgets KF5::DBusAddons KF5::Notifications KF5::I18n Qt5::Widgets)
ecm_mark_nongui_executable(kdeconnectd)
......
......@@ -19,8 +19,7 @@ else ()
endif()
add_executable(kdeconnect-indicator ${indicator_SRCS})
target_include_directories(kdeconnect-indicator PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces kdeconnectcore)
target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces kdeconnectcore kdeconnectversion)
if (WIN32)
add_compile_definitions(QSYSTRAY)
endif()
......
......@@ -17,7 +17,6 @@ set_target_properties(kdeconnectpluginkcm PROPERTIES
SOVERSION ${KDECONNECT_VERSION_MAJOR}
)
target_include_directories(kdeconnectpluginkcm PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
generate_export_header(kdeconnectpluginkcm EXPORT_FILE_NAME kdeconnectpluginkcm_export.h BASE_NAME kdeconnectpluginkcm)
# Remove NAMELINK_SKIP if/when headers are being installed and the library becomes public.
......
......@@ -24,7 +24,7 @@ add_library(kdeconnectsmshelper STATIC
${smshelper_debug_file_SRCS}
)
target_include_directories(kdeconnectsmshelper PUBLIC ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(kdeconnectsmshelper PUBLIC ${CMAKE_SOURCE_DIR})
target_link_libraries(kdeconnectsmshelper
PUBLIC
......@@ -43,11 +43,10 @@ add_executable(kdeconnect-sms
resources.qrc
${sms_debug_files_SRCS})
target_include_directories(kdeconnect-sms PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(kdeconnect-sms
kdeconnectsmshelper
kdeconnectinterfaces
kdeconnectversion
Qt5::Quick
Qt5::Widgets
KF5::CoreAddons
......
......@@ -2,11 +2,10 @@ ki18n_wrap_ui(telhandler_SRCS dialog.ui)
add_executable(kdeconnect-handler kdeconnect-handler.cpp ${telhandler_SRCS})
target_include_directories(kdeconnect-handler PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(kdeconnect-handler
kdeconnectinterfaces
kdeconnectcore
kdeconnectversion
Qt5::Widgets
KF5::CoreAddons
KF5::I18n
......
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