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 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) # Installs a QML declarative plugin and its qmldir file
add_custom_command(TARGET copy_to_build_dir_bin POST_BUILD #
COMMAND ${CMAKE_COMMAND} -E function(install_qml_plugin plugin_name qml_install_dir_path)
copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_BINARY_DIR}/bin/org/kde/kdeconnect/)
add_dependencies(kdeconnectdeclarativeplugin copy_to_build_dir_bin) install(TARGETS ${plugin_name} DESTINATION ${QML_INSTALL_DIR}/${qml_install_dir_path})
set_target_properties(kdeconnectdeclarativeplugin install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/${qml_install_dir_path})
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/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
COMMAND ${CMAKE_COMMAND} -E
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")