forked from 4lex4/scantailor-advanced
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
503 lines (428 loc) · 17.7 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
# Disable in-source builds.
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR
"FATAL: In-source builds are not allowed."
" You should create a separate directory for build files.")
endif()
# Set cmake policies.
if (POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
project("ScanTailor Advanced")
# Set compiler flags.
set(CMAKE_CXX_STANDARD 17)
if (NOT DEFAULT_COMPILER_FLAGS_IS_SET)
if (MSVC)
option(WIN_XP "Whether to build for Windows XP." OFF)
if (WIN_XP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_USING_V110_SDK71_")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_USING_V110_SDK71_")
set(CMAKE_EXE_LINKER_FLAGS "/SUBSYSTEM:CONSOLE,5.01 /SUBSYSTEM:WINDOWS,5.01 ${CMAKE_EXE_LINKER_FLAGS}")
endif()
# Disable checked iterators for extra performance.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_SECURE_SCL=0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SECURE_SCL=0")
if (DEBUG_CLI)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DDEBUG_CLI")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DDEBUG_CLI")
endif()
elseif (WIN_XP)
unset(WIN_XP CACHE)
message(WARNING "Only MSVC toolchain is supported to build for Windows XP.")
endif()
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -Werror=return-type -Wno-unused")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror=return-type -Wno-unused")
add_compile_options("$<$<CONFIG:RELEASE>:-march=native;-mtune=native>")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}"
CACHE STRING "Common C flags for all build configurations." FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}"
CACHE STRING "Common C++ flags for all build configurations." FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Common link flags for all build configurations." FORCE)
set(DEFAULT_COMPILER_FLAGS_IS_SET YES CACHE INTERNAL "" FORCE)
endif()
if (UNIX)
option(CMAKE_POSITION_INDEPENDENT_CODE "" ON)
option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "" ON)
endif()
include(cmake/SetDefaultBuildType.cmake)
include(cmake/UpdateTranslations.cmake)
include(cmake/ListItemsPrepend.cmake)
if (WIN32)
include(cmake/CopyToBuildDir.cmake)
include(cmake/AddDynamicLibraryLocations.cmake)
endif()
st_set_default_build_type(Release)
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif()
if (NOT CMAKE_INSTALL_BINDIR)
if (WIN32)
set(CMAKE_INSTALL_BINDIR ".")
else()
set(CMAKE_INSTALL_BINDIR "bin")
endif()
endif()
#=================================== Dependencies ===================================#
if (WIN32)
macro(real_path_find_glob Var Glob)
file(GLOB ${Var} "${Glob}")
if (${Var})
list(GET ${Var} -1 ${Var})
get_filename_component("${Var}" "${${Var}}" REALPATH)
endif()
endmacro()
get_filename_component(lib_dir "${PROJECT_SOURCE_DIR}/../libs" REALPATH)
set(DEPENDENCIES_ROOT "${lib_dir}" CACHE PATH
"The assumed directory where all the required libraries are installed.")
if (EXISTS "${DEPENDENCIES_ROOT}")
real_path_find_glob(jpeg_dir_assumed "${DEPENDENCIES_ROOT}/jpeg-[0-9]*")
real_path_find_glob(zlib_dir_assumed "${DEPENDENCIES_ROOT}/zlib-[0-9]*.[0-9]*.[0-9]*")
real_path_find_glob(png_dir_assumed "${DEPENDENCIES_ROOT}/libpng-[0-9]*.[0-9]*.[0-9]*")
real_path_find_glob(tiff_dir_assumed "${DEPENDENCIES_ROOT}/tiff-[0-9]*.[0-9]*.[0-9]*")
get_filename_component(qt_dir_assumed "${DEPENDENCIES_ROOT}/Qt" REALPATH)
get_filename_component(boost_dir_assumed "${DEPENDENCIES_ROOT}/Boost" REALPATH)
endif()
set(JPEG_INSTALL_PREFIX "${jpeg_dir_assumed}" CACHE PATH "Prefix where jpeg is installed")
set(ZLIB_INSTALL_PREFIX "${zlib_dir_assumed}" CACHE PATH "Prefix where zlib is installed")
set(PNG_INSTALL_PREFIX "${png_dir_assumed}" CACHE PATH "Prefix where png is installed")
set(TIFF_INSTALL_PREFIX "${tiff_dir_assumed}" CACHE PATH "Prefix where tiff is installed")
set(QT_INSTALL_PREFIX "${qt_dir_assumed}" CACHE PATH "Prefix where Qt is installed")
set(BOOST_ROOT "${boost_dir_assumed}" CACHE PATH "Prefix where Boost is installed")
macro(list_append_existing_path Var Path)
get_filename_component(_real_path "${Path}" REALPATH)
if (EXISTS "${_real_path}")
list(APPEND "${Var}" "${_real_path}")
endif()
endmacro()
foreach(_prefix
"${JPEG_INSTALL_PREFIX}" "${ZLIB_INSTALL_PREFIX}" "${PNG_INSTALL_PREFIX}"
"${TIFF_INSTALL_PREFIX}" "${QT_INSTALL_PREFIX}" "${BOOST_ROOT}")
list_append_existing_path(CMAKE_PREFIX_PATH "${_prefix}")
list_append_existing_path(CMAKE_INCLUDE_PATH "${_prefix}")
list_append_existing_path(CMAKE_LIBRARY_PATH "${_prefix}/stage/lib")
endforeach()
list_append_existing_path(CMAKE_INCLUDE_PATH "${TIFF_INSTALL_PREFIX}/libtiff")
endif()
#=================================== JPEG ===================================#
find_package(JPEG REQUIRED)
if (WIN32)
add_dynamic_library_locations(JPEG::JPEG "libjpeg-62.dll")
endif()
#=================================== ZLIB ===================================#
find_package(ZLIB REQUIRED)
if (WIN32)
add_dynamic_library_locations(ZLIB::ZLIB)
endif()
#================================== PNG ==================================#
find_package(PNG REQUIRED)
if (WIN32)
add_dynamic_library_locations(PNG::PNG "libpng16.dll")
endif()
#=================================== TIFF ===================================#
find_package(TIFF REQUIRED)
if (WIN32)
add_dynamic_library_locations(TIFF::TIFF)
set_target_properties(
TIFF::TIFF PROPERTIES
INTERFACE_COMPILE_DEFINITIONS USE_LIBTIFF_DLL)
endif()
#================================= Boost ================================#
#set(Boost_NO_WARN_NEW_VERSIONS ON)
if (WIN32)
if (MINGW)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_boost_architecture "-x64")
else()
set(_boost_architecture "-x32")
endif()
set(Boost_ARCHITECTURE ${_boost_architecture} CACHE STRING "")
#set(Boost_DEBUG ON)
string(REGEX MATCHALL "[0-9]+" _boost_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
list(GET _boost_compiler_version 0 _boost_compiler_version_major)
list(GET _boost_compiler_version 1 _boost_compiler_version_minor)
set(Boost_COMPILER "-mgw${_boost_compiler_version_major}" CACHE STRING "")
endif()
real_path_find_glob(boost_include_dir_hints "${BOOST_ROOT}/include/boost-[_0-9]*/boost")
list(APPEND boost_include_dir_hints "${BOOST_ROOT}/include/boost" "${BOOST_ROOT}/boost")
find_path(
BOOST_INCLUDEDIR config.hpp
HINTS ${boost_include_dir_hints}
DOC "Boost include directory.")
set(Boost_USE_STATIC_LIBS ON)
endif()
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.60 COMPONENTS unit_test_framework prg_exec_monitor REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_definitions(-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
if (NOT Boost_USE_STATIC_LIBS)
if (WIN32)
add_dynamic_library_locations(Boost::unit_test_framework Boost::prg_exec_monitor)
endif()
add_definitions(-DBOOST_TEST_DYN_LINK)
endif()
#=================================== Qt ===================================#
set(qt_min_version 5.9)
find_package(
Qt6
COMPONENTS Core Gui Widgets Xml Network LinguistTools OpenGL Svg OpenGLWidgets
CONFIG)
if (Qt6_FOUND)
set(QT_BINDIR "${QT6_INSTALL_PREFIX}/bin")
else()
find_package(Qt5 ${qt_min_version}
COMPONENTS Core Gui Widgets Xml Network LinguistTools OpenGL Svg
CONFIG REQUIRED)
set(QT_BINDIR "${QT5_INSTALL_PREFIX}/bin")
endif()
if(Qt6_FOUND)
set(Qt_Core_lib Qt::Core)
set(Qt_Gui_lib Qt::Gui)
set(Qt_Network_lib Qt::Network)
set(Qt_OpenGL_lib Qt::OpenGL)
set(Qt_Svg_lib Qt::Svg)
set(Qt_Widgets_lib Qt::Widgets)
set(Qt_Xml_lib Qt::Xml)
set(Qt_OpenGLWidgets_lib Qt::OpenGLWidgets)
else()
set(Qt_Core_lib Qt5::Core)
set(Qt_Gui_lib Qt5::Gui)
set(Qt_Network_lib Qt5::Network)
set(Qt_OpenGL_lib Qt5::OpenGL)
set(Qt_Svg_lib Qt5::Svg)
set(Qt_Widgets_lib Qt5::Widgets)
set(Qt_Xml_lib Qt5::Xml)
endif()
#=================================== Threads ===================================#
if (UNIX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
link_libraries(Threads::Threads)
endif()
#=================================== System ===================================#
set(EXTRA_LIBS "")
if (WIN32)
list(APPEND EXTRA_LIBS winmm imm32 ws2_32 ole32 oleaut32 uuid gdi32 comdlg32 winspool)
endif()
#=================================== Main ===================================#
set(CMAKE_AUTOMOC ON)
if (WIN32 AND MSVC)
add_definitions(-DNOMINMAX)
endif()
enable_testing()
# Prepare config.h
option(PORTABLE_VERSION "Whether to build the portable version." ON)
if (PORTABLE_VERSION)
set(PORTABLE_CONFIG_DIR "config")
endif()
set(APPLICATION_NAME "scantailor-advanced")
if (WIN32)
set(TRANSLATION_DIRS ".:translations")
set(PLUGIN_DIRS ".")
else()
set(TRANSLATION_DIRS ".:translations:../share/${APPLICATION_NAME}/translations")
set(PLUGIN_DIRS ".:../lib/${APPLICATION_NAME}")
endif()
configure_file(config.h.in "${CMAKE_BINARY_DIR}/config.h" @ONLY)
file(READ "${CMAKE_BINARY_DIR}/config.h" config_h_contents)
set(enable_developer_version_default OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(enable_developer_version_default ON)
endif()
option(DEVELOPER_VERSION "Whether to enable the internal debug features." ${enable_developer_version_default})
if (NOT DEVELOPER_VERSION)
string(REGEX REPLACE "(#define[ \\t]+ENABLE_DEBUG_FEATURES[^\n]*)" "//\\1" config_h_contents ${config_h_contents})
endif()
file(WRITE "${CMAKE_BINARY_DIR}/config.h" ${config_h_contents})
include_directories(BEFORE "${CMAKE_BINARY_DIR}")
# Extract VERSION and VERSION_QUAD from version.h
file(READ "${PROJECT_SOURCE_DIR}/version.h.in" version_h_contents)
string(
REGEX REPLACE
".*#define[ \\t]+VERSION[ \\t]+\"([^\"]*)\".*"
"\\1" VERSION "${version_h_contents}")
if ("${VERSION}" STREQUAL "${version_h_contents}")
message(FATAL_ERROR "Failed to extract VERSION from version.h")
endif()
# VERSION_QUAD must be either empty or be in the form of X.Y.Z.Y
string(
REGEX REPLACE
".*#define[ \\t]+VERSION_QUAD[ \\t]+\"(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)?)\".*"
"\\1" VERSION_QUAD "${version_h_contents}")
if ("${VERSION_QUAD}" STREQUAL "${version_h_contents}")
message(FATAL_ERROR "Failed to extract VERSION_QUAD from version.h")
endif()
configure_file(version.h.in "${CMAKE_BINARY_DIR}/version.h" COPYONLY)
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" APPLICATION_VERSION_MAJOR "${VERSION}")
string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" APPLICATION_VERSION_MINOR "${VERSION}")
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" APPLICATION_VERSION_PATCH "${VERSION}")
set(SCANTAILOR_RESOURCES_DIR "${CMAKE_SOURCE_DIR}/src/resources")
set(SCANTAILOR_TRANSLATIONS_DIR "${CMAKE_SOURCE_DIR}/src/translations")
add_subdirectory(src)
# Translations
file(GLOB translation_files "${SCANTAILOR_TRANSLATIONS_DIR}/scantailor_*.ts")
finalize_translations(scantailor ${translation_files})
update_translations_target(update_translations scantailor)
list(FILTER translation_files EXCLUDE REGEX ".*untranslated.ts")
if(Qt6_FOUND)
Qt_add_translation(qm_files ${translation_files})
else()
Qt5_add_translation(qm_files ${translation_files})
endif()
add_custom_target(compile_translations ALL DEPENDS ${qm_files})
if (WIN32)
install(FILES ${qm_files} DESTINATION "${CMAKE_INSTALL_BINDIR}/translations")
else()
install(FILES ${qm_files} DESTINATION "share/${APPLICATION_NAME}/translations")
endif()
# Install extra files.
if (WIN32)
macro (add_runtime_libs_to_install Configuration Libs)
set(configurations "${Configuration}")
if (${configurations} MATCHES "ALL")
set(configurations "DEBUG;RELEASE")
endif()
foreach (_config ${configurations})
foreach (_lib ${Libs})
if (EXISTS "${_lib}")
list(APPEND "ADDITIONAL_RUNTIME_LIBS_${_config}" "${_lib}")
endif()
endforeach()
endforeach()
endmacro()
macro (set_if_undefined Var Value)
if (NOT ${Var})
set(${Var} "${Value}")
endif()
endmacro()
# Install the DLLs of the dependencies.
if(Qt6_FOUND)
set(dep_libs
JPEG::JPEG PNG::PNG ZLIB::ZLIB TIFF::TIFF
Qt::Core Qt::Gui Qt::Widgets Qt::Xml
Qt::Network Qt::OpenGL Qt::Svg Qt6::OpenGLWidgets)
else()
set(dep_libs
JPEG::JPEG PNG::PNG ZLIB::ZLIB TIFF::TIFF
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml
Qt5::Network Qt5::OpenGL Qt5::Svg)
endif()
foreach (_target ${dep_libs})
get_target_property(target_type ${_target} TYPE)
if (target_type STREQUAL "SHARED_LIBRARY")
set(dynlib_location_property LOCATION)
elseif (target_type STREQUAL "UNKNOWN_LIBRARY")
set(dynlib_location_property IMPORTED_DYNLIB)
else()
continue()
endif()
get_target_property(release_loc ${_target} ${dynlib_location_property}_RELEASE)
get_target_property(debug_loc ${_target} ${dynlib_location_property}_DEBUG)
set_if_undefined(debug_loc "${release_loc}")
add_runtime_libs_to_install(RELEASE "${release_loc}")
add_runtime_libs_to_install(DEBUG "${debug_loc}")
endforeach()
#with Qt6, winqtdeploy is used to deploy plugins; the method below does not work anymore.
if (NOT Qt6_FOUND)
# Install Qt plugins.
macro (install_qt_plugin SubDir Target)
if (TARGET ${Target})
get_target_property(target_type ${Target} TYPE)
if (target_type STREQUAL "MODULE_LIBRARY")
get_target_property(release_loc ${Target} LOCATION_RELEASE)
get_target_property(debug_loc ${Target} LOCATION_DEBUG)
set_if_undefined(debug_loc "${release_loc}")
copy_to_build_dir("${release_loc}" SUBDIR ${SubDir} CONFIGURATIONS Release MinSizeRel RelWithDebInfo)
install(PROGRAMS "${release_loc}"
CONFIGURATIONS Release MinSizeRel RelWithDebInfo
DESTINATION "${CMAKE_INSTALL_BINDIR}/${SubDir}")
copy_to_build_dir("${debug_loc}" SUBDIR ${SubDir} CONFIGURATIONS Debug)
install(PROGRAMS "${debug_loc}"
CONFIGURATIONS Debug
DESTINATION "${CMAKE_INSTALL_BINDIR}/${SubDir}")
endif()
endif()
endmacro()
install_qt_plugin("platforms" Qt::QWindowsIntegrationPlugin)
install_qt_plugin("styles" Qt::QWindowsVistaStylePlugin)
install_qt_plugin("imageformats" Qt::QJpegPlugin)
install_qt_plugin("accessible" Qt::QAccessiblePlugin)
install_qt_plugin("iconengines" Qt::QSvgIconPlugin)
install_qt_plugin("imageformats" Qt::QSvgPlugin)
endif()
# Install MinGW runtime components.
if (MINGW)
get_filename_component(_mingw_path ${CMAKE_CXX_COMPILER} PATH)
file(GLOB libgcc_s "${_mingw_path}/libgcc_s_*.dll")
file(GLOB libstdcpp "${_mingw_path}/libstdc++*.dll")
file(GLOB libwinpthread "${_mingw_path}/libwinpthread*.dll")
add_runtime_libs_to_install(ALL "${libgcc_s};${libstdcpp};${libwinpthread}")
endif()
copy_to_build_dir(${ADDITIONAL_RUNTIME_LIBS_RELEASE} CONFIGURATIONS Release MinSizeRel RelWithDebInfo)
copy_to_build_dir(${ADDITIONAL_RUNTIME_LIBS_DEBUG} CONFIGURATIONS Debug)
# Generate the target that will actually do the copying.
generate_copy_to_build_dir_target(copy_to_build_dir)
install(PROGRAMS ${ADDITIONAL_RUNTIME_LIBS_RELEASE} TYPE BIN CONFIGURATIONS Release MinSizeRel RelWithDebInfo)
install(PROGRAMS ${ADDITIONAL_RUNTIME_LIBS_DEBUG} TYPE BIN CONFIGURATIONS Debug)
endif()
if (UNIX)
install(FILES "${SCANTAILOR_RESOURCES_DIR}/unix/scantailor.desktop"
DESTINATION "share/applications")
install(FILES "${SCANTAILOR_RESOURCES_DIR}/appicon.svg"
DESTINATION "share/icons/hicolor/scalable/apps"
RENAME "ScanTailor.svg")
install(FILES "${SCANTAILOR_RESOURCES_DIR}/unix/mime/scantailor-project.xml"
DESTINATION "share/mime/packages")
endif()
if (WIN32 AND MSVC)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
endif()
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}")
include(InstallRequiredSystemLibraries)
# Packaging
set(CPACK_PACKAGE_NAME "${APPLICATION_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR "${APPLICATION_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}")
set(CPACK_PACKAGE_VENDOR "4lex4 <[email protected]>")
set(CPACK_PACKAGE_CONTACT "${CPACK_PACKAGE_VENDOR}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Interactive post-processing tool for scanned pages.")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_EXECUTABLES "scantailor;${CMAKE_PROJECT_NAME}")
set(CPACK_CREATE_DESKTOP_LINKS "scantailor")
if (WIN32)
set(CPACK_NSIS_INSTALLED_ICON_NAME "scantailor.exe")
set(CPACK_NSIS_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_NSIS_DISPLAY_NAME "${CMAKE_PROJECT_NAME} ${VERSION}")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
set(CPACK_NSIS_CREATE_ICONS_EXTRA
"CreateShortCut \\\"$DESKTOP\\\\${CMAKE_PROJECT_NAME}.lnk\\\" \\\"$INSTDIR\\\\scantailor.exe\\\"")
set(CPACK_NSIS_DELETE_ICONS_EXTRA
"Delete \\\"$DESKTOP\\\\${CMAKE_PROJECT_NAME}.lnk\\\"")
endif()
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${APPLICATION_NAME}-${VERSION}")
set(CPACK_SOURCE_IGNORE_FILES
"/\\\\.svn/"
"/\\\\.git/"
"~$"
"\\\\.pcs$"
"TODO.txt"
"CMakeLists.txt.user"
"/doxygen/"
"${CMAKE_BINARY_DIR}")
include(CPack)
# uninstall target
if (NOT TARGET uninstall)
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
add_custom_target(
uninstall
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
endif()