~verzegnassi-stefano/+junk/docviewer-tmp-001

« back to all changes in this revision

Viewing changes to src/plugin/file-qml-plugin/CMakeLists.txt

  • Committer: Tarmac
  • Author(s): David Planella, Daniel Holbach, Fabio Colella, Stefano Verzegnassi, Arto Jalkanen
  • Date: 2014-10-29 07:39:08 UTC
  • mfrom: (31.1.22 add-plugin)
  • Revision ID: tarmac-20141029073908-8s6r18syexjo37ga
Adds the file plugin to the source tree.

Approved by Stefano Verzegnassi, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
cmake_minimum_required(VERSION 2.8.9)
 
2
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
3
 
 
4
set(PLUGIN_DIR com/ubuntu/fileqmlplugin)
 
5
 
 
6
#set cpp flags
 
7
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra -fPIC")
 
8
 
 
9
# Standard install paths
 
10
include(GNUInstallDirs)
 
11
 
 
12
#add the sources to compile
 
13
set(fileqmlplugin_SRCS
 
14
        backend.cpp
 
15
        backend.h
 
16
        docviewerFile.cpp
 
17
        docviewerFile.h
 
18
        fileReader.cpp
 
19
        fileReader.h
 
20
        )
 
21
 
 
22
#should be deprecated in current cmake version
 
23
#qt5_use_modules(Qml Quick)
 
24
 
 
25
add_library(fileqmlplugin MODULE
 
26
    ${fileqmlplugin_SRCS}
 
27
)
 
28
 
 
29
qt5_use_modules(fileqmlplugin Gui Qml Quick)
 
30
 
 
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"
 
40
    )
 
41
endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
 
42
 
 
43
# Install plugin file
 
44
install(TARGETS fileqmlplugin DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR})
 
45
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR})