forked from KDAB/GammaRay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
973 lines (874 loc) · 33.4 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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
# This file is part of GammaRay, the Qt application inspection and manipulation tool.
#
# SPDX-FileCopyrightText: 2010-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Contact KDAB at <[email protected]> for commercial licensing options.
#
# This is the top-level CMakeLists.txt file for the GammaRay project.
#
# Pass the following variables to cmake to control the build:
# (See INSTALL.md for more information)
#
# -DQT_VERSION_MAJOR=[5|6]
# Build against QtX version
# Default=(The first Qt version found by cmake or the one provided by CMAKE_PREFIX_PATH will be used)
#
# -DGAMMARAY_PROBE_ONLY_BUILD=[true|false]
# Build only an additional probe configuration for an already existing launcher
# Default=false
#
# -DGAMMARAY_CLIENT_ONLY_BUILD=[true|false]
# Build the client part only
# Default=false
#
# -DGAMMARAY_BUILD_UI=[true|false]
# Build the GammaRay client and in-process UI
# Default=true (false for QNX or Android)
#
# -DGAMMARAY_INSTALL_QT_LAYOUT=[true|false]
# Install into Qt directory layout
# Default=false
#
# -DGAMMARAY_MULTI_BUILD=[true|false]
# Build multiple applicable probe configurations
# Default=true
#
# -DGAMMARAY_BUILD_CLI_INJECTOR=[true|false]
# Build command line injector on Windows
# Default=true (ignored on non-Windows systems)
#
# -DGAMMARAY_STATIC_PROBE=[true|false]
# Build the probe as static library for compile-time injection
# Default=false
#
# -DGAMMARAY_CORE_ONLY_LAUNCHER=[true|false]
# Only use QtCore in the CLI launcher (breaks style injector, but is needed for Boot2Qt compatibility
# Default=false
#
# -DGAMMARAY_DISABLE_FEEDBACK=[true|false]
# Disable user feedback support
# Default=false (always true if cross-compiling or building probe-only (see GAMMARAY_PROBE_ONLY_BUILD))
#
# -DGAMMARAY_BUILD_DOCS=[true|false]
# Build GammaRay documentation
# Default=true (always false if cross-compiling or building probe-only (see GAMMARAY_PROBE_ONLY_BUILD))
#
# -DGAMMARAY_ENFORCE_QT_ASSERTS=[true|false]
# Force QT_ASSERT in all builds
# Default=false
#
# -DGAMMARAY_USE_PCH=[true|false]
# Enable Precompiled Headers support
# Default=false
#
# -DENABLE_GOLD_LINKER=[true|false]
# Use GNU gold linker
# Default=false
#
cmake_minimum_required(VERSION 3.16.0)
project(
GammaRay
VERSION 3.0.1
LANGUAGES CXX C
)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/find-modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/KDAB/modules)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_AUTOMOC TRUE)
set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTORCC TRUE)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT DEFINED CMAKE_SKIP_BUILD_RPATH)
set(CMAKE_SKIP_BUILD_RPATH ON)
endif()
if(NOT DEFINED CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
endif()
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
if(NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH TRUE)
endif()
# Set a default build type if none was specified
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to ${default_build_type} as none was specified.")
set(CMAKE_BUILD_TYPE
"${default_build_type}"
CACHE STRING "Choose the type of build." FORCE
)
# Set the possible values of build type for cmake-gui
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo"
)
endif()
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCXXSymbolExists)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CMakeParseArguments)
include(CMakePushCheckState)
include(CTest)
include(GammaRayMacros)
include(GammaRayMacrosInternal)
include(FeatureSummary)
set(KDE_INSTALL_USE_QT_SYS_PATHS OFF)
include(ECMGeneratePriFile)
include(ECMEnableSanitizers)
include(GenerateExportHeader)
include("3rdparty/backward-cpp/BackwardConfig.cmake")
# Exit for blacklisted compilers (those that don't support full C++11)
# MSVC++ < 2015 aka 1900
# Clang 3.1
set(BAD_CXX_MESSAGE "")
if(MSVC)
if(MSVC_VERSION LESS 1900)
set(BAD_CXX_MESSAGE "MSVC 2015 or higher")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1.0)
set(BAD_CXX_MESSAGE "Clang v3.1.0 or higher")
endif()
endif()
if(BAD_CXX_MESSAGE)
message(FATAL_ERROR "\nSorry, ${BAD_CXX_MESSAGE} is required to build this software. "
"Please retry using a compiler that supports C++11."
)
endif()
set(GAMMARAY_REQUIRED_CXX_FEATURES
cxx_lambdas
cxx_nullptr
cxx_range_for
cxx_raw_string_literals
cxx_uniform_initialization
cxx_variadic_templates
cxx_rvalue_references
cxx_defaulted_functions
cxx_deleted_functions
cxx_override
cxx_final
cxx_nonstatic_member_init
)
# Version setup
set(GAMMARAY_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(GAMMARAY_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(GAMMARAY_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(GAMMARAY_VERSION ${PROJECT_VERSION})
set(GAMMARAY_VERSION_STRING "${GAMMARAY_VERSION}")
set(GAMMARAY_SOVERSION "3.0.0")
set(GAMMARAY_PLUGIN_VERSION "3.0")
set(PROJECT_VERSION_STRING "${GAMMARAY_VERSION_STRING}")
if(ANDROID)
# non-rooted Android doesn't like .so versions and requires the lib prefix
set(GAMMARAY_DEFAULT_LIBRARY_PROPERTIES PREFIX "lib")
else()
set(GAMMARAY_DEFAULT_LIBRARY_PROPERTIES SOVERSION ${GAMMARAY_SOVERSION} VERSION ${GAMMARAY_SOVERSION})
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
find_package(Git)
set_package_properties(
Git PROPERTIES
TYPE OPTIONAL
PURPOSE "Determine exact build version."
)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _git_revision
)
string(REGEX REPLACE "\n" "" _git_revision "${_git_revision}")
set(GAMMARAY_VERSION_STRING "${GAMMARAY_VERSION_STRING} (revision: ${_git_revision})")
endif()
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-gammaray-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gammaray-version.h
)
message(STATUS "Building GammaRay ${GAMMARAY_VERSION_STRING} in ${CMAKE_BUILD_TYPE} mode")
#
# Build options
#
set(GAMMARAY_BUILD_UI_DEFAULT ON)
if(QNXNTO OR ANDROID)
set(GAMMARAY_BUILD_UI_DEFAULT OFF)
endif()
gammaray_option(
GAMMARAY_PROBE_ONLY_BUILD "Build only an additional probe configuration for an already existing launcher." OFF
)
gammaray_option(GAMMARAY_CLIENT_ONLY_BUILD "Build the client part only." OFF)
if(GAMMARAY_CLIENT_ONLY_BUILD)
set(GAMMARAY_BUILD_UI_DEFAULT ON)
endif()
if(GAMMARAY_PROBE_ONLY_BUILD)
set(GAMMARAY_BUILD_UI_DEFAULT OFF)
endif()
gammaray_option(GAMMARAY_BUILD_UI "Build the GammaRay client and in-process UI." ${GAMMARAY_BUILD_UI_DEFAULT})
if(GAMMARAY_PROBE_ONLY_BUILD AND GAMMARAY_CLIENT_ONLY_BUILD)
message(FATAL_ERROR "You can only use one of the *ONLY* option.")
endif()
gammaray_option(GAMMARAY_INSTALL_QT_LAYOUT "Install into Qt directory layout." OFF)
gammaray_option(GAMMARAY_MULTI_BUILD "Build multiple applicable probe configurations." ON)
gammaray_option(GAMMARAY_BUILD_CLI_INJECTOR "Build command line injector on Windows." ON)
set(GAMMARAY_BUILD_DOCS_DEFAULT ON)
set(GAMMARAY_DISABLE_FEEDBACK_DEFAULT OFF)
if(GAMMARAY_PROBE_ONLY_BUILD OR CMAKE_CROSSCOMPILING)
set(GAMMARAY_BUILD_DOCS_DEFAULT OFF)
set(GAMMARAY_DISABLE_FEEDBACK_DEFAULT ON)
endif()
gammaray_option(GAMMARAY_BUILD_DOCS "Build GammaRay documentation." ${GAMMARAY_BUILD_DOCS_DEFAULT})
gammaray_option(GAMMARAY_STATIC_PROBE "Build the probe as static library for compile-time injection." OFF)
gammaray_option(GAMMARAY_ENFORCE_QT_ASSERTS "Force QT_ASSERT in all builds." OFF)
gammaray_option(GAMMARAY_DISABLE_FEEDBACK "Disable user feedback support." ${GAMMARAY_DISABLE_FEEDBACK_DEFAULT})
#
# Static probe setup
#
if(GAMMARAY_STATIC_PROBE)
set(GAMMARAY_BUILD_UI OFF)
set(GAMMARAY_PROBE_ONLY_BUILD ON)
set(GAMMARAY_LIBRARY_TYPE STATIC)
set(GAMMARAY_PLUGIN_TYPE STATIC)
else()
set(GAMMARAY_LIBRARY_TYPE SHARED)
set(GAMMARAY_PLUGIN_TYPE MODULE)
endif()
gammaray_option(GAMMARAY_USE_PCH "Enable Precompiled Headers support" OFF)
if(GAMMARAY_USE_PCH)
add_library(gammaray_pch_core_gui STATIC)
file(
GENERATE
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp
CONTENT "/*dummy pch file*/"
)
target_sources(gammaray_pch_core_gui PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp)
target_link_libraries(gammaray_pch_core_gui PRIVATE Qt::Core Qt::Gui)
set_target_properties(
gammaray_pch_core_gui
PROPERTIES PRECOMPILE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/core/pch.h
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
endif()
#
# Compiler & linker settings
#
function(append_if condition value)
if(${condition})
foreach(variable ${ARGN})
set(${variable}
"${${variable}} ${value}"
PARENT_SCOPE
)
endforeach()
endif()
endfunction()
# Add a C or C++ compiler flag if the compiler supports that flag
macro(add_flag_if_supported flag name)
check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}")
append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS)
check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}")
append_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS)
endmacro()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_flag_if_supported(-Wunused-but-set-variable UNUSED_BUT_SET)
add_flag_if_supported(-Wlogical-op LOGICAL_OP)
add_flag_if_supported(-Wsizeof-pointer-memaccess POINTER_MEMACCESS)
add_flag_if_supported(-Wreorder REORDER)
add_flag_if_supported(-Wformat-security FORMAT_SECURITY)
add_flag_if_supported(-Wsuggest-override SUGGEST_OVERRIDE)
check_cxx_compiler_flag(-std=gnu++0x HAVE_GXX_GNUXX11)
check_cxx_compiler_flag(-std=c++0x HAVE_GXX_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Woverloaded-virtual -Winit-self")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-include-dirs -Wunused -Wundef -Wpointer-arith")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-noreturn -Werror=return-type -Wswitch")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# -Wgnu-zero-variadic-macro-arguments (part of -pedantic) is triggered by every qCDebug()
# call and therefore results in a lot of noise. This warning is only notifying us that clang
# is emulating the GCC behaviour instead of the exact standard wording so we can safely ignore it
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
endif()
if(HAVE_GXX_GNUXX11) # QNX needs gnu++0x rather than c++0x for compiling QML V4 private headers
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
elseif(HAVE_GXX_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
if(MINGW)
# mingw will error out on the crazy casts in probe.cpp without this
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -Wdocumentation")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -Wdocumentation")
endif()
# Do not treat the operator name keywords and, bitand, bitor, compl, not, or and xor as synonyms as keywords.
# They're not supported under Visual Studio out of the box thus using them limits the portability of code
if(CMAKE_COMPILER_IS_GNUCXX
OR CMAKE_C_COMPILER_ID MATCHES "Clang"
OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-operator-names")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-") #use strict C++ compliance
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") #conversion from __int64 to int possible loss of data
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") #conversion from size_t to int possible loss of data
endif()
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE -D_USING_V110_SDK71_=1)
endif()
if(QNXNTO)
add_definitions(-D_QNX_SOURCE)
endif()
if(CYGWIN)
add_definitions(-D_GNU_SOURCE)
endif()
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES Linux)
# Gold linker
gammaray_option(ENABLE_GOLD_LINKER "Use GNU gold linker" OFF)
if(ENABLE_GOLD_LINKER)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
OUTPUT_VARIABLE stdout
ERROR_QUIET
)
if("${stdout}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
else()
message(FATAL_ERROR "GNU gold linker isn't available.")
endif()
endif()
endif()
# linker flags
if((CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) AND (CMAKE_COMPILER_IS_GNUCXX
OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
)
set(_linker_flags "-Wl,-z,origin")
if(NOT ECM_ENABLE_SANITIZERS)
set(_linker_flags "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${_linker_flags}")
endif()
set(CMAKE_SHARED_LINKER_FLAGS "${_linker_flags} ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${_linker_flags} ${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${_linker_flags} ${CMAKE_EXE_LINKER_FLAGS}")
endif()
if(GAMMARAY_ENFORCE_QT_ASSERTS)
add_definitions(-DQT_FORCE_ASSERTS)
endif()
if(GAMMARAY_QT6_BUILD) #to support the "old-way" of specifying a Qt6 build
set(QT_VERSION_MAJOR 6)
endif()
if(NOT DEFINED QT_VERSION_MAJOR)
#
# Finding Qt
#
find_package(
QT
5.5
NAMES
Qt6
Qt5
COMPONENTS Core NO_MODULE
REQUIRED
)
endif()
set_package_properties(Qt${QT_VERSION_MAJOR}Core PROPERTIES TYPE REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS Gui Network)
find_package(
Qt${QT_VERSION_MAJOR} NO_MODULE QUIET
OPTIONAL_COMPONENTS
3DAnimation
3DExtras
3DInput
3DLogic
3DRender
3DQuick
Bluetooth
Concurrent
Designer
Location
OpenGL
Positioning
Qml
Quick
QuickWidgets
Svg
Script
ScriptTools
Test
WebEngineWidgets
Widgets
WaylandCompositor
)
if(ANDROID)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS AndroidExtras)
endif()
# Find these 'exotic' Qt modules without using find_package(... COMPONENTS)
# so we can retrieve those packages even when installed into a different prefix
find_package(Qt${QT_VERSION_MAJOR}IviCore 1.1 NO_MODULE QUIET) # 1.1 is based on 5.8
find_package(Qt${QT_VERSION_MAJOR}IviVehicleFunctions 1.1 NO_MODULE QUIET)
find_package(Qt${QT_VERSION_MAJOR}IviMedia 1.1 NO_MODULE QUIET)
find_package(Qt${QT_VERSION_MAJOR}Scxml 5.8 NO_MODULE QUIET)
# if translation/doc host tools are missing, the Qt5 cmake config files throw errors...
if(GAMMARAY_BUILD_DOCS)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help LinguistTools)
endif()
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
add_compile_options(/Zc:__cplusplus)
endif()
if(MINGW)
# prevent 'file too big' and 'too many sections' errors with Qt6
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")
endif()
endif()
# these need to included after the last Qt-related find_package() call
include(Qt5LegacySupport)
include(ECMQt5ToQt6Porting)
set(MACOS_DISABLE_UNSUPPORTED_TESTS FALSE)
if(APPLE)
cmake_host_system_information(RESULT MACOS_RELEASE QUERY OS_RELEASE)
message(STATUS "MACOS_RELEASE: ${MACOS_RELEASE}")
message(STATUS "QtQuick_VERSION: ${QtQuick_VERSION}")
if(MACOS_RELEASE VERSION_GREATER_EQUAL 10.15.0 AND QtQuick_VERSION VERSION_LESS 5.12.0)
# Qt Quick is only supported on macOS Catalina using Qt 5.12 and above
set(MACOS_DISABLE_UNSUPPORTED_TESTS TRUE)
message(WARNING "Your version of MacOS is too old (less then 10.15) to use with QtQuick 5.12 or higher. "
"You can solve this by upgrading your MacOS or using older Qt versions. "
"Disabling QtQuick capabilities."
)
endif()
endif()
if(MACOS_DISABLE_UNSUPPORTED_TESTS)
set(Qt5Quick_FOUND FALSE)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND Qt5Core_VERSION VERSION_EQUAL 5.9.1)
# hide -Wc++1z-extensions warnings in this Qt version -- see: https://bugreports.qt.io/browse/QTBUG-61840
add_flag_if_supported(-Wno-c++1z-extensions NO_CPP1Z_EXTENSIONS)
endif()
if(QtCore_VERSION VERSION_GREATER 5.7)
# Qt 5.8 is the first minor version to use nullptr more broadly
# With versions below Qt might lots of warnings for -Wzero-as-null-pointer-constant, e.g.:
# .../examples/widget-layouting/ui_contactform.h:606:85:
# warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
add_flag_if_supported(-Wzero-as-null-pointer-constant ZERO_AS_NULL_POINTER_CONSTANT)
endif()
if(GAMMARAY_BUILD_UI) # widgets are required for the UI
find_package(Qt${QtCore_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS Widgets)
endif()
set(HAVE_QT_CONCURRENT ${QtConcurrent_FOUND})
set(HAVE_QT_WIDGETS ${QtWidgets_FOUND})
set(HAVE_QT_SVG ${QtSvg_FOUND})
set(HAVE_QT_SCXML ${QtScxml_FOUND})
set(HAVE_QT_DESIGNER ${QtDesigner_FOUND})
if(TARGET Qt::Gui)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES Qt::Gui)
check_cxx_symbol_exists(QT_NO_OPENGL "QOpenGLContext" QT_NO_OPENGL)
cmake_pop_check_state()
endif()
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050500)
#add_definitions(-DQT_DEPRECATED_WARNINGS)
if(NOT DEFINED QT_LIBINFIX)
set(QT_LIBINFIX "")
endif()
set_package_properties(Qt${QT_VERSION_MAJOR} PROPERTIES URL "https://qt.io/")
set_package_properties(
Qt${QT_VERSION_MAJOR}Concurrent PROPERTIES
TYPE RECOMMENDED
PURPOSE "Required for the GammaRay launcher process list."
)
set_package_properties(
Qt${QT_VERSION_MAJOR}Widget PROPERTIES
TYPE RECOMMENDED
PURPOSE "Required for the GammaRay client UI and widget-related tools."
)
set_package_properties(
Qt${QT_VERSION_MAJOR}Svg PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for widget SVG export."
)
# debug suffixes for qmake compatibility
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
elseif(APPLE)
set(CMAKE_DEBUG_POSTFIX "_debug")
else()
set(CMAKE_DEBUG_POSTFIX "")
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_CMAKE_BUILD_TYPE)
if(NOT UPPERCASE_CMAKE_BUILD_TYPE MATCHES "^REL")
set(GAMMARAY_PROBE_ABI_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
endif()
add_definitions(
-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING
)
if(NOT WIN32)
# BIC on MSVC at least (see e.g. https://bugreports.qt.io/browse/AUTOSUITE-946)
add_definitions(-DQT_STRICT_ITERATORS)
endif()
if(UPPERCASE_CMAKE_BUILD_TYPE MATCHES "^RELEASE$")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()
if(HAVE_QT_WIDGETS)
gammaray_option(
GAMMARAY_CORE_ONLY_LAUNCHER
"Only use QtCore in the CLI launcher (breaks style injector, but is needed for Boot2Qt compatibility)" FALSE
)
else()
set(GAMMARAY_CORE_ONLY_LAUNCHER TRUE)
endif()
add_feature_info("QtScript debugger" Qt5ScriptTools_FOUND "Requires QtScript and QtScriptTools.")
add_feature_info("Widget .ui file export" HAVE_QT_DESIGNER "Requires QtDesigner library.")
#
# Additional dependencies
#
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_symbol_exists(backtrace execinfo.h HAVE_BACKTRACE)
check_cxx_symbol_exists(abi::__cxa_demangle cxxabi.h HAVE_CXA_DEMANGLE)
# ELF header for ABI detection
find_file(HAVE_ELF_H elf.h)
find_file(HAVE_SYS_ELF_H sys/elf.h)
if(HAVE_ELF_H OR HAVE_SYS_ELF_H)
set(HAVE_ELF TRUE)
endif()
add_feature_info("ELF ABI detection" HAVE_ELF "Automatic probe ABI detection on ELF-based systems. Requires elf.h.")
find_package(QmlLint)
set_package_properties(
QmlLint PROPERTIES
URL "https://qt.io"
PURPOSE "Validate QML code."
)
find_package(KF${QtCore_VERSION_MAJOR}SyntaxHighlighting 5.28 NO_MODULE QUIET)
set_package_properties(
KF${QtCore_VERSION_MAJOR}SyntaxHighlighting PROPERTIES
TYPE RECOMMENDED
URL "https://www.kde.org/"
PURPOSE "Syntax highlighting for code editor."
)
if(TARGET KF${QtCore_VERSION_MAJOR}::SyntaxHighlighting)
set(HAVE_SYNTAX_HIGHLIGHTING TRUE)
endif()
#
# Determine probe ABI
# this needs to be run after we know exactly what we are building, but is needed for that installation settings
include(GammaRayProbeABI)
#
# Installation settings
#
set(BUNDLE_INSTALL_DIR "")
if(ANDROID)
set(GAMMARAY_INSTALL_QT_LAYOUT ON)
endif()
if(APPLE)
set(BUNDLE_APP_NAME "GammaRay.app")
if(GAMMARAY_INSTALL_QT_LAYOUT)
set(BUNDLE_INSTALL_DIR "bin")
set(RESOURCES_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/${BUNDLE_APP_NAME}/Contents/Resources")
set(BIN_INSTALL_DIR "bin")
set(INCLUDE_INSTALL_DIR "include/gammaray")
set(LIB_INSTALL_DIR "lib")
set(LIBEXEC_INSTALL_DIR "libexec")
set(CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/GammaRay")
set(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/gammaray")
set(MAN_INSTALL_DIR "man/man1")
set(DOC_INSTALL_DIR "doc/gammaray")
set(QCH_INSTALL_DIR "doc")
set(TRANSLATION_INSTALL_DIR "translations")
else()
# Make sure default prefix on mac is /Applications, dunnow why but it does not default to it
# probably because we do not enabled built in bundle support in the main project
string(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "/usr/local" CMP_RESULT)
if(CMP_RESULT)
set(CMAKE_INSTALL_PREFIX "/Applications")
endif()
set(BUNDLE_INSTALL_DIR ".")
set(RESOURCES_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/${BUNDLE_APP_NAME}/Contents/Resources")
set(BIN_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/${BUNDLE_APP_NAME}/Contents/MacOS")
set(LIB_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/${BUNDLE_APP_NAME}/Contents/Frameworks")
set(PLUGIN_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/${BUNDLE_APP_NAME}/Contents/PlugIns/gammaray")
set(LIBEXEC_INSTALL_DIR "${BIN_INSTALL_DIR}")
set(MAN_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/man/man1")
set(DOC_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/docs")
set(QCH_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/docs")
set(TRANSLATION_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/translations")
set(INCLUDE_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/include/gammaray")
set(CMAKECONFIG_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/cmake/GammaRay")
set(ECM_MKSPECS_INSTALL_DIR "${RESOURCES_INSTALL_DIR}/${ECM_MKSPECS_INSTALL_DIR}")
endif()
else()
# Set installation paths
# This takes care of installing into "lib64" on distros that use that, for instance,
# by setting CMAKE_INSTALL_FULL_LIBDIR.
include(GNUInstallDirs)
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") # relative, usually "bin"
gammaray_convert_to_relative_path(BIN_INSTALL_DIR)
if(GAMMARAY_INSTALL_QT_LAYOUT)
set(LIB_INSTALL_DIR "lib") # Qt always uses "lib"
else()
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") # "lib" or "lib64"
gammaray_convert_to_relative_path(LIB_INSTALL_DIR)
endif()
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/gammaray")
set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/GammaRay)
set(DATAROOTDIR
"${CMAKE_INSTALL_DATAROOTDIR}"
CACHE PATH "Define install directory for read-only architecture-independent data"
)
gammaray_convert_to_relative_path(DATAROOTDIR)
set(XDG_APPS_INSTALL_DIR "${DATAROOTDIR}/applications")
set(APPDATA_INSTALL_DIR "${DATAROOTDIR}/metainfo")
set(ICON_INSTALL_DIR "${DATAROOTDIR}/icons")
set(MAN_INSTALL_DIR "${DATAROOTDIR}/man/man1")
set(QCH_INSTALL_DIR
"${CMAKE_INSTALL_DOCDIR}"
CACHE PATH "Install location of Qt Assistant help files."
)
gammaray_convert_to_relative_path(QCH_INSTALL_DIR)
set(ZSHAUTOCOMPLETE_INSTALL_DIR "${DATAROOTDIR}/zsh/site-functions")
if(WIN32)
set(PLUGIN_INSTALL_DIR "plugins/gammaray")
set(LIBEXEC_INSTALL_DIR "${BIN_INSTALL_DIR}")
set(DOC_INSTALL_DIR .)
set(TRANSLATION_INSTALL_DIR "translations")
else()
set(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/gammaray")
set(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/gammaray/libexec")
set(DOC_INSTALL_DIR "${DATAROOTDIR}/doc/gammaray/")
set(TRANSLATION_INSTALL_DIR "${DATAROOTDIR}/gammaray/translations")
endif()
endif()
if(NOT GAMMARAY_INSTALL_QT_LAYOUT)
set(PROBE_BASENAME "gammaray_probe")
else()
set(PROBE_BASENAME "${CMAKE_SHARED_LIBRARY_PREFIX}gammaray_probe")
endif()
if(GAMMARAY_INSTALL_QT_LAYOUT)
if(WIN32)
set(PROBE_INSTALL_DIR ${BIN_INSTALL_DIR})
else()
set(PROBE_INSTALL_DIR ${LIB_INSTALL_DIR})
endif()
set(PROBE_PLUGIN_INSTALL_DIR "plugins/gammaray")
set(PLUGIN_INSTALL_DIR ${PROBE_PLUGIN_INSTALL_DIR})
set(TARGET_PLUGIN_INSTALL_DIR "plugins/gammaray-target")
else()
set(PROBE_INSTALL_DIR
"${PLUGIN_INSTALL_DIR}/${GAMMARAY_PLUGIN_VERSION}/${GAMMARAY_PROBE_ABI}${GAMMARAY_PROBE_ABI_POSTFIX}"
)
set(PROBE_PLUGIN_INSTALL_DIR ${PROBE_INSTALL_DIR})
set(TARGET_PLUGIN_INSTALL_DIR "${PROBE_INSTALL_DIR}/target")
endif()
if(NOT GAMMARAY_OUTPUT_PREFIX) # set by multibuild
set(GAMMARAY_OUTPUT_PREFIX ${PROJECT_BINARY_DIR})
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${GAMMARAY_OUTPUT_PREFIX}/${BIN_INSTALL_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${GAMMARAY_OUTPUT_PREFIX}/${LIB_INSTALL_DIR})
set(INSTALL_TARGETS_DEFAULT_ARGS
RUNTIME
DESTINATION
${BIN_INSTALL_DIR}
LIBRARY
DESTINATION
${LIB_INSTALL_DIR}
ARCHIVE
DESTINATION
${LIB_INSTALL_DIR}
COMPONENT
Devel
BUNDLE
DESTINATION
${BUNDLE_INSTALL_DIR}
)
# "inverse" install dirs, to find the base location again
if(APPLE)
set(BUNDLE_INSTALL_DIR_PRIVATE "${BUNDLE_INSTALL_DIR}/${BUNDLE_APP_NAME}/Contents/MacOS")
gammaray_inverse_dir(GAMMARAY_INVERSE_BUNDLE_DIR "${BUNDLE_INSTALL_DIR_PRIVATE}")
else()
set(BUNDLE_INSTALL_DIR_PRIVATE "")
set(GAMMARAY_INVERSE_BUNDLE_DIR "")
endif()
gammaray_inverse_dir(GAMMARAY_INVERSE_BIN_DIR "${BIN_INSTALL_DIR}")
gammaray_inverse_dir(GAMMARAY_INVERSE_LIB_DIR "${LIB_INSTALL_DIR}")
gammaray_inverse_dir(GAMMARAY_INVERSE_PROBE_DIR "${PROBE_INSTALL_DIR}")
gammaray_inverse_dir(GAMMARAY_INVERSE_LIBEXEC_DIR "${LIBEXEC_INSTALL_DIR}")
#
# actually build the stuff
#
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-gammaray.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gammaray.h)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty ${CMAKE_BINARY_DIR})
include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables
add_subdirectory(cmake)
add_subdirectory(3rdparty/kde)
add_subdirectory(common)
add_subdirectory(core)
add_subdirectory(probe)
add_subdirectory(launcher)
if(GAMMARAY_BUILD_UI AND TARGET Qt::Widgets)
if(NOT GAMMARAY_DISABLE_FEEDBACK)
add_subdirectory(3rdparty/kuserfeedback)
endif()
add_subdirectory(ui)
if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
add_subdirectory(inprocessui)
endif()
if(NOT GAMMARAY_PROBE_ONLY_BUILD)
add_subdirectory(client)
add_subdirectory(app)
endif()
endif()
if(BUILD_TESTING
AND TARGET Qt::Test
AND NOT CMAKE_CROSSCOMPILING
)
add_subdirectory(tests)
endif()
add_subdirectory(plugins)
if(QtLinguistTools_FOUND)
add_subdirectory(translations)
endif()
if(GAMMARAY_MULTI_BUILD)
add_subdirectory(multibuild)
endif()
if(GAMMARAY_BUILD_DOCS)
add_subdirectory(examples)
add_subdirectory(docs) # needs to go last, so see all installed headers for the API docs
endif()
# IDE Support (e.g. for QtCreator): Make the IDE aware of other files as well
file(GLOB ALL_OTHER_FILES_LIST "*.md")
add_custom_target(
ALL_OTHER_FILES
SOURCES ${ALL_OTHER_FILES_LIST}
COMMENT "Target for IDE support to make the IDE aware of other files"
)
set(LICENSE_FILE "LICENSE.txt")
set(README_FILE "README.md")
list(APPEND DOCS ${LICENSE_FILE} ${README_FILE})
if(NOT APPLE AND NOT GAMMARAY_PROBE_ONLY_BUILD)
if(UNIX AND GAMMARAY_BUILD_UI)
install(FILES GammaRay.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES com.kdab.GammaRay.metainfo.xml DESTINATION ${APPDATA_INSTALL_DIR})
endif()
install(FILES ${DOCS} DESTINATION ${DOC_INSTALL_DIR})
install(DIRECTORY LICENSES DESTINATION ${DOC_INSTALL_DIR})
endif()
#
# cppcheck
#
find_program(CPPCHECK_EXECUTABLE cppcheck)
if(CPPCHECK_EXECUTABLE)
set(_cppcheck_flags "-I${CMAKE_CURRENT_BINARY_DIR}")
get_directory_property(_inc_dirs INCLUDE_DIRECTORIES)
foreach(_current ${_inc_dirs})
set(_cppcheck_flags ${_cppcheck_flags} "-I${_current}")
endforeach()
get_directory_property(_defs COMPILE_DEFINITIONS)
foreach(_current ${_defs})
set(_cppcheck_flags ${_cppcheck_flags} "-D${_current}")
endforeach()
# cmake-lint: disable=C0301
add_custom_target(
cppcheck
COMMAND
${CPPCHECK_EXECUTABLE} --enable=all --inconclusive -f --suppress=*:${QT_INSTALL_HEADERS}* ${_cppcheck_flags}
-i${CMAKE_CURRENT_SOURCE_DIR}/3rdparty -i${CMAKE_CURRENT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running the cppcheck static code checker"
)
endif()
#
# CMake package config file generation
#
if(NOT GAMMARAY_PROBE_ONLY_BUILD)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/GammaRayConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GammaRayConfig.cmake
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/GammaRayConfigVersion.cmake
VERSION ${GAMMARAY_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GammaRayConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/GammaRayConfigVersion.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(
EXPORT GammaRayTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE GammaRayTarget.cmake
# NAMESPACE GammaRay::
)
endif()
#CPACK: General Settings
set(CPACK_GENERATOR "TBZ2")
set(CPACK_PACKAGE_NAME "gammaray")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An introspection tool for Qt applications")
#TODO: shorten lines in the Readme.txt to make rpmlint happy
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/${README_FILE}")
set(CPACK_PACKAGE_VENDOR "Klaralvdalens Datakonsult AB (KDAB)")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_VERSION_MAJOR "${GAMMARAY_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${GAMMARAY_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${GAMMARAY_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${GAMMARAY_VERSION}")
#CPACK: RPM Specific Settings
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2+")
set(CPACK_RPM_PACKAGE_GROUP "Development/Tools")
#CPACK: DEB Specific Settings
set(CPACK_DEBIAN_PACKAGE_SECTION "Development")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/${README_FILE}")
if(WIN32)
set(ICONS_DIR "${CMAKE_SOURCE_DIR}/resources")
set(CPACK_GENERATOR "NSIS" "ZIP")
set(CPACK_PACKAGE_EXECUTABLES "GammaRay" "GammaRay")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "GammaRay")
set(CPACK_PACKAGE_FILE_NAME "GammaRay ${GAMMARAY_VERSION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/${LICENSE_FILE}")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY "${BIN_INSTALL_DIR}")
set(CPACK_NSIS_MUI_ICON "${ICONS_DIR}/GammaRay.ico")
#set(CPACK_PACKAGE_ICON "${ICONS_DIR}\\\\CharmNSISHeader.bmp")
set(CPACK_NSIS_URL_INFO_ABOUT "https://www.kdab.com/")
set(CPACK_NSIS_INSTALLED_ICON_NAME "GammaRay${CMAKE_EXECUTABLE_SUFFIX}")
set(CPACK_NSIS_MENU_LINKS "${LICENSE_FILE}" "License" "${README_FILE}" "Readme")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${CPACK_NSIS_INSTALLED_ICON_NAME}")
elseif(APPLE)
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_FORMAT "UDBZ")
set(CPACK_DMG_VOLUME_NAME "GammaRay")
set(CPACK_SYSTEM_NAME "OSX")
set(CPACK_PACKAGE_FILE_NAME "GammaRay-${GAMMARAY_VERSION}")
set(CPACK_PACKAGE_ICON "${ICONS_DIR}/CharmDMG.icns")
set(CPACK_DMG_DS_STORE "${ICONS_DIR}/CharmDSStore")
set(CPACK_DMG_BACKGROUND_IMAGE "${ICONS_DIR}/CharmDMGBackground.png")
elseif(UNIX)
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
endif()
include(CPack)
include(PackageIFW)
addpackagetarget(GammaRay gammaray_probe install lib)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)