| 1 |
include_directories( |
| 2 |
${CMAKE_CURRENT_SOURCE_DIR} |
| 3 |
) |
| 4 |
|
| 5 |
set(PLUGIN_DIR Lomiri/FileManager/Archives) |
| 6 |
|
| 7 |
set(archives_SRCS |
| 8 |
archives.cpp |
| 9 |
archives.h |
| 10 |
archives_plugin.cpp |
| 11 |
archives_plugin.h |
| 12 |
) |
| 13 |
|
| 14 |
add_library(Archives MODULE |
| 15 |
${archives_SRCS} |
| 16 |
) |
| 17 |
|
| 18 |
target_link_libraries(Archives Qt5::Gui Qt5::Qml Qt5::Quick Qt5::Widgets) |
| 19 |
|
| 20 |
# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator |
| 21 |
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") |
| 22 |
add_custom_command(TARGET Archives POST_BUILD |
| 23 |
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} |
| 24 |
COMMENT "Creating plugin directory layout in the build directory" |
| 25 |
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} |
| 26 |
COMMENT "Copying the qmldir file to the build directory" |
| 27 |
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Archives> ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} |
| 28 |
COMMENT "Copying the plugin binary to the build directory" |
| 29 |
) |
| 30 |
endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") |
| 31 |
|
| 32 |
# Install plugin file |
| 33 |
install(TARGETS Archives DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) |
| 34 |
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) |
| 35 |
|