1
cmake_minimum_required(VERSION 2.8.9)
2
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
4
set(PLUGIN_DIR com/ubuntu/fileqmlplugin)
7
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra -fPIC")
9
# Standard install paths
10
include(GNUInstallDirs)
12
#add the sources to compile
13
set(fileqmlplugin_SRCS
22
#should be deprecated in current cmake version
23
#qt5_use_modules(Qml Quick)
25
add_library(fileqmlplugin MODULE
29
qt5_use_modules(fileqmlplugin Gui Qml Quick)
31
# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator
32
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
33
add_custom_command(TARGET fileqmlplugin POST_BUILD
34
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
35
COMMENT "Creating plugin directory layout in the build directory"
36
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
37
COMMENT "Copying the qmldir file to the build directory"
38
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:fileqmlplugin> ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
39
COMMENT "Copying the plugin binary to the build directory"
41
endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
44
install(TARGETS fileqmlplugin DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR})
45
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR})