-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
104 lines (89 loc) · 4.06 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# /*
# dspdfviewer - Dual Screen PDF Viewer for LaTeX-Beamer
# Copyright (C) 2012 Danny Edel <mail@danny-edel.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# */
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
if( NOT CMAKE_VERSION VERSION_LESS 3.1)
cmake_policy(SET CMP0054 NEW) # dont expand quoted strings in if()s
endif()
if( NOT CMAKE_VERSION VERSION_LESS 3.10)
cmake_policy(SET CMP0071 NEW) # Also process generated source files with MOC
endif()
if( NOT CMAKE_VERSION VERSION_LESS 3.17)
cmake_policy(SET CMP0100 NEW) # Allow .hh extension
endif()
project(dspdfviewer)
include(FindPkgConfig)
set(CMAKE_AUTOMOC ON)#
set(CMAKE_AUTORCC OFF)
set(CMAKE_INCLUDE_CURRENT_DIR OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(UpdateTranslations "Do you want to update the .ts files (WARNING: running make clean will delete them!)" OFF)
option(BuildTests "Build unit tests (this requires pdflatex or internet access and DownloadTestPDFs=ON)" ON)
option(RunDualScreenTests "Also run tests that require two screens to be connected" ON)
option(RunTestsOnBigEndian "Run tests on a big-endian system" OFF)
option(BoostStaticLink "Link statically against the boost libraries" OFF)
option(WindowsStaticLink "Windows/MSVC only: Link statically against the dependencies and set /MT instead of /MD" ON)
option(UsePrerenderedPDF "Use prerendered PDFs included in the source for testing, instead of building with pdflatex" OFF)
option(CodeCoverage "Add coverage analysis code to the program. Will slow it down. A lot. Only supported on GCC right now." OFF)
option(WarningAsError "Turn on -Werror and similar compiler settings. This can be useful during development, but is disabled by default for release build scripts." OFF)
include(cmake/platforms.cmake)
include(cmake/filelists.cmake)
include(cmake/external_libraries.cmake)
include(cmake/qrc_embedding.cmake)
include(cmake/compilers.cmake)
include(cmake/version_number.cmake)
if( I3WORKAROUND_SHELLCODE )
add_definitions(-DI3WORKAROUND_SHELLCODE="${I3WORKAROUND_SHELLCODE}")
endif()
include_directories(SYSTEM ${LIST_INCLUDE_DIRS})
### Compile all the source code into one .a file
add_library(libdspdfviewer ${libdspdfviewer_SRCS} ${dspdfviewer_UIS_H} ${TRANSLATIONS})
# Set target name to "libdspdfviewer"
# without a prefix (normally unix would auto-add lib...)
set_target_properties(libdspdfviewer PROPERTIES
PREFIX ""
)
target_link_libraries(libdspdfviewer ${LIST_LIBRARIES})
### And link it together with main.cpp to produce an executable
add_executable(dspdfviewer ${dspdfviewer_SRCS} ${EMBEDDED_QRC})
target_link_libraries(dspdfviewer libdspdfviewer)
### ... and link it with the tests to produce a testing executable.
if(BuildTests)
# Run unit tests regardless of debug/release
# Set a default timeout to 60 seconds
set(DART_TESTING_TIMEOUT 60)
set(CTEST_TEST_TIMEOUT 60)
# Check for big endian
include(TestBigEndian)
TEST_BIG_ENDIAN(BigEndian)
if( NOT BigEndian OR RunTestsOnBigEndian)
include(CTest)
add_subdirectory(testing)
else()
message(WARNING "The unit tests have been temporarily disabled on big-endian "
"systems. If you want to help in debugging this, please pass "
"-DRunTestsOnBigEndian=ON to cmake to force their execution.")
endif()
endif()
#### Installation
install(TARGETS dspdfviewer
RUNTIME DESTINATION bin)
install(FILES dspdfviewer.1
DESTINATION share/man/man1)
install(FILES dspdfviewer.desktop
DESTINATION share/applications)