1
cmake_minimum_required(VERSION 2.8.9)
2
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
4
set(PLUGIN_DIR org/ubuntu/popplerqmlplugin)
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(popplerqmlplugin_SRCS
26
#should be deprecated in current cmake version
27
#qt5_use_modules(Qml Quick)
29
add_library(popplerqmlplugin MODULE
30
${popplerqmlplugin_SRCS}
33
target_link_libraries(popplerqmlplugin poppler-qt5)
35
qt5_use_modules(popplerqmlplugin Gui Qml Quick)
37
# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator
38
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
39
add_custom_command(TARGET popplerqmlplugin POST_BUILD
40
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
41
COMMENT "Creating plugin directory layout in the build directory"
42
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
43
COMMENT "Copying the qmldir file to the build directory"
44
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:popplerqmlplugin> ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
45
COMMENT "Copying the plugin binary to the build directory"
47
endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
50
install(TARGETS popplerqmlplugin DESTINATION ${QT_IMPORTS_DIR}/org/ubuntu/popplerqmlplugin/)
51
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/org/ubuntu/popplerqmlplugin/)