Compare commits

...

1 commit

Author SHA1 Message Date
Albert Vaca
8542e6311c Added macro to install a declarative plugin 2019-07-23 14:08:16 +02:00

View file

@ -17,15 +17,25 @@ target_link_libraries(kdeconnectdeclarativeplugin
kdeconnectinterfaces
)
install(TARGETS kdeconnectdeclarativeplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kdeconnect)
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/kdeconnect)
# So qml apps using this plugin can be run from build/bin directory
add_custom_target(copy_to_build_dir_bin)
add_custom_command(TARGET copy_to_build_dir_bin POST_BUILD
##
# Installs a QML declarative plugin and its qmldir file
#
function(install_qml_plugin plugin_name qml_install_dir_path)
install(TARGETS ${plugin_name} DESTINATION ${QML_INSTALL_DIR}/${qml_install_dir_path})
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/${qml_install_dir_path})
# So qml apps using this plugin can be run from build/bin directory
add_custom_target(copy_to_build_dir_bin)
add_custom_command(TARGET copy_to_build_dir_bin POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_BINARY_DIR}/bin/org/kde/kdeconnect/)
add_dependencies(kdeconnectdeclarativeplugin copy_to_build_dir_bin)
set_target_properties(kdeconnectdeclarativeplugin
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/kdeconnect/
)
copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_BINARY_DIR}/bin/${qml_install_dir_path})
add_dependencies(${plugin_name} copy_to_build_dir_bin)
set_target_properties(${plugin_name}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${qml_install_dir_path}
)
endfunction()
install_qml_plugin(kdeconnectdeclarativeplugin "org/kde/kdeconnect")