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.
This commit is contained in:
parent
e2e303d7cc
commit
79164ca8ba
8 changed files with 11 additions and 13 deletions
|
@ -34,6 +34,10 @@ ecm_setup_version(1.4.0
|
||||||
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kdeconnect-version.h
|
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)
|
if (SAILFISHOS)
|
||||||
set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config)
|
set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config)
|
||||||
set(KF5_OPTIONAL_COMPONENTS)
|
set(KF5_OPTIONAL_COMPONENTS)
|
||||||
|
|
|
@ -3,11 +3,10 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdeconnect-cli\")
|
||||||
add_executable(kdeconnect-cli kdeconnect-cli.cpp)
|
add_executable(kdeconnect-cli kdeconnect-cli.cpp)
|
||||||
ecm_mark_nongui_executable(kdeconnect-cli)
|
ecm_mark_nongui_executable(kdeconnect-cli)
|
||||||
|
|
||||||
target_include_directories(kdeconnect-cli PUBLIC ${CMAKE_BINARY_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(kdeconnect-cli
|
target_link_libraries(kdeconnect-cli
|
||||||
kdeconnectinterfaces
|
kdeconnectinterfaces
|
||||||
kdeconnectcore
|
kdeconnectcore
|
||||||
|
kdeconnectversion
|
||||||
KF5::CoreAddons
|
KF5::CoreAddons
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
)
|
)
|
||||||
|
|
|
@ -52,7 +52,7 @@ set(kdeconnectcore_SRCS
|
||||||
|
|
||||||
add_library(kdeconnectcore ${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
|
target_link_libraries(kdeconnectcore
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
|
|
@ -8,8 +8,7 @@ ecm_qt_declare_logging_category(
|
||||||
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (daemon)")
|
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (daemon)")
|
||||||
|
|
||||||
add_executable(kdeconnectd kdeconnectd.cpp ${debug_file_SRCS})
|
add_executable(kdeconnectd kdeconnectd.cpp ${debug_file_SRCS})
|
||||||
target_include_directories(kdeconnectd PUBLIC ${CMAKE_BINARY_DIR})
|
target_link_libraries(kdeconnectd kdeconnectcore kdeconnectversion KF5::KIOWidgets KF5::DBusAddons KF5::Notifications KF5::I18n Qt5::Widgets)
|
||||||
target_link_libraries(kdeconnectd kdeconnectcore KF5::KIOWidgets KF5::DBusAddons KF5::Notifications KF5::I18n Qt5::Widgets)
|
|
||||||
|
|
||||||
ecm_mark_nongui_executable(kdeconnectd)
|
ecm_mark_nongui_executable(kdeconnectd)
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,7 @@ else ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(kdeconnect-indicator ${indicator_SRCS})
|
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 kdeconnectversion)
|
||||||
target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces kdeconnectcore)
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
add_compile_definitions(QSYSTRAY)
|
add_compile_definitions(QSYSTRAY)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -17,7 +17,6 @@ set_target_properties(kdeconnectpluginkcm PROPERTIES
|
||||||
SOVERSION ${KDECONNECT_VERSION_MAJOR}
|
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)
|
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.
|
# 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}
|
${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
|
target_link_libraries(kdeconnectsmshelper
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
@ -43,11 +43,10 @@ add_executable(kdeconnect-sms
|
||||||
resources.qrc
|
resources.qrc
|
||||||
${sms_debug_files_SRCS})
|
${sms_debug_files_SRCS})
|
||||||
|
|
||||||
target_include_directories(kdeconnect-sms PUBLIC ${CMAKE_BINARY_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(kdeconnect-sms
|
target_link_libraries(kdeconnect-sms
|
||||||
kdeconnectsmshelper
|
kdeconnectsmshelper
|
||||||
kdeconnectinterfaces
|
kdeconnectinterfaces
|
||||||
|
kdeconnectversion
|
||||||
Qt5::Quick
|
Qt5::Quick
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
KF5::CoreAddons
|
KF5::CoreAddons
|
||||||
|
|
|
@ -2,11 +2,10 @@ ki18n_wrap_ui(telhandler_SRCS dialog.ui)
|
||||||
|
|
||||||
add_executable(kdeconnect-handler kdeconnect-handler.cpp ${telhandler_SRCS})
|
add_executable(kdeconnect-handler kdeconnect-handler.cpp ${telhandler_SRCS})
|
||||||
|
|
||||||
target_include_directories(kdeconnect-handler PUBLIC ${CMAKE_BINARY_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(kdeconnect-handler
|
target_link_libraries(kdeconnect-handler
|
||||||
kdeconnectinterfaces
|
kdeconnectinterfaces
|
||||||
kdeconnectcore
|
kdeconnectcore
|
||||||
|
kdeconnectversion
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
KF5::CoreAddons
|
KF5::CoreAddons
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
|
|
Loading…
Reference in a new issue