-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
90 lines (71 loc) · 2.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required(VERSION 3.1.0)
project(QtPDF)
set(CMAKE_CXX_STANDARD 14)
IF (WIN32)
MESSAGE(STATUS "Now is windows")
set(CMAKE_PREFIX_PATH "C:\\Qt\\5.15.2\\msvc2019_64\\bin")
set(Qt5_DIR "C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5")
set(PDFium_DIR "${CMAKE_SOURCE_DIR}/3rdparty/pdfium-win-x64")
ELSEIF (APPLE)
MESSAGE(STATUS "Now is Apple systens.")
ELSEIF (UNIX)
MESSAGE(STATUS "Now is UNIX-like OS's.")
ENDIF ()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
add_definitions(-DQT_BUILD_PDF_LIB) #定义导出宏
include_directories(./
./pdf/api/
./QtPdf/
)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
get_target_property(QtCore_location Qt5::Widgets LOCATION)
find_package(Qt5 COMPONENTS Core REQUIRED)
get_target_property(QtCore_location Qt5::Core LOCATION)
find_package(Qt5 COMPONENTS Network REQUIRED)
get_target_property(QtCore_location Qt5::Network LOCATION)
add_library(QtPDF SHARED
# ./pdf/qtpdf-config.h
#./pdf/api/qtpdfglobal.h
# ./pdf/qpdfselection.cpp
# ./pdf/api/qpdfselection.h
# ./pdf/api/qpdfselection_p.h
./pdf/api/qpdfbookmarkmodel.h
./pdf/api/qpdfdestination_p.h
./pdf/api/qpdfdestination.h
./pdf/api/qpdfdocument_p.h
./pdf/api/qpdfdocument.h
./pdf/api/qpdfdocumentrenderoptions.h
./pdf/api/qpdflinkmodel_p_p.h
./pdf/api/qpdflinkmodel_p.h
./pdf/api/qpdfnamespace.h
./pdf/api/qpdfpagenavigation.h
./pdf/api/qpdfpagerenderer.h
./pdf/api/qpdfsearchmodel_p.h
./pdf/api/qpdfsearchmodel.h
./pdf/api/qpdfsearchresult_p.h
./pdf/api/qpdfsearchresult.h
./pdf/api/qpdfselection_p.h
./pdf/api/qpdfselection.h
./pdf/qpdfdestination.cpp
./pdf/qpdfdocument.cpp
./pdf/qpdfbookmarkmodel.cpp
./pdf/qpdflinkmodel.cpp
./pdf/qpdfpagenavigation.cpp
./pdf/qpdfpagerenderer.cpp
./pdf/qpdfsearchmodel.cpp
./pdf/qpdfsearchresult.cpp
./pdf/qpdfselection.cpp
)
find_package(PDFium)
target_link_libraries(QtPDF Qt5::Widgets Qt5::Core Qt5::GuiPrivate Qt5::CorePrivate Qt5::Network pdfium)
#todo windows copy
add_custom_command(TARGET ${PROJECT_NAME}
PRE_BUILD
COMMAND echo "executing a fake command"
COMMENT "This command will be executed before building target Test1"
)