forked from robertknight/Qt-Inspector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
83 lines (68 loc) · 1.76 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
cmake_minimum_required(VERSION 2.8.9)
project("Qt Widget Inspector")
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
option(USE_QT5 "USE QT5" OFF)
if (NOT USE_QT5)
message("Building with Qt 4. Enable the USE_QT5 option to build with Qt 5")
endif()
if (USE_QT5)
find_package(Qt5Core REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Widgets REQUIRED)
else()
find_package(Qt4 REQUIRED)
set(QT_USE_QTNETWORK true)
include(${QT_USE_FILE})
endif()
find_package(Protobuf REQUIRED)
find_package(Threads REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
if (MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
endif()
add_subdirectory(lib)
set(
CLASSES
ExternalObjectProxy
ExternalWidgetPicker
ObjectInspector
ObjectPropertyModel
ObjectTreeModel
OutOfProcessClipboard
TargetApplicationProxy
WidgetInspector
WidgetInspectorShortcut
)
if(UNIX)
set(CLASSES ${CLASSES} GdbLibraryInjector PreloadInjector)
endif()
foreach(CLASS ${CLASSES})
set(SOURCES ${SOURCES} ${CLASS}.cpp)
set(HEADERS ${HEADERS} ${CLASS}.h)
endforeach()
add_executable(
qtinspector
main.cpp
${SOURCES}
)
if (UNIX AND NOT APPLE)
# compile main.cpp as position-independent code so
# that taking the address of the qtInspectorInit symbol
# in order to get the path of the libQtInspector library works
# as expected.
#
# See the notes in the 'Bugs' section for the dladdr() function
# at http://linux.die.net/man/3/dlopen
set_target_properties(qtinspector PROPERTIES COMPILE_FLAGS -fPIC)
endif()
target_link_libraries(
qtinspector
QtInspector
${QT_LIBRARIES}
)
if (USE_QT5)
qt5_use_modules(qtinspector Network Widgets)
endif()
install(TARGETS qtinspector RUNTIME DESTINATION bin)