1
- PROCESS_SOURCES()
1
+ # CMakeLists.txt for libyui-qt/src
2
+
3
+ include ( ../VERSION .cmake )
4
+ include ( GNUInstallDirs ) # set CMAKE_INSTALL_INCLUDEDIR, ..._LIBDIR
5
+
6
+ # Use the package PkgConfig to detect GTK+ headers/library files
7
+ FIND_PACKAGE (PkgConfig REQUIRED)
8
+ PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
9
+
10
+ PKG_CHECK_MODULES(YUI REQUIRED libyui)
11
+
12
+ message (" " ${YUI_INCLUDE_DIRS} ${YUI_LIBRARY_DIRS} )
13
+
14
+ find_library (YUYU libyui)
15
+
16
+
17
+ #
18
+ # libyui plugin specific
19
+ #
20
+
21
+ set ( TARGETLIB libyui-gtk )
22
+ set ( TARGETLIB_BASE yui-gtk )
23
+
24
+ set ( HEADERS_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} /yui/gtk )
25
+ set ( PLUGIN_DIR ${CMAKE_INSTALL_LIBDIR} /yui ) # /usr/lib64/yui
26
+
27
+ # if DESTDIR is set, CMAKE_INSTALL_INCLUDEDIR already contains it
28
+ # during "make install" (but not for other make targets!):
29
+ #
30
+ # sudo make install DESTDIR=/work/foo
31
+ # or
32
+ # DESTDIR=/work/foo sudo make install
33
+ #
34
+ # -> the include files are installed to /work/foo/usr/include/...
35
+ # We need that for RPM builds to install everything to $RPM_BUILD_ROOT.
36
+
37
+
38
+ set ( SOURCES
39
+ YGBarGraph.cc
40
+ YGComboBox.cc
41
+ YGDialog.cc
42
+ ygdkmngloader.c
43
+ YGDumbTab.cc
44
+ YGFrame.cc
45
+ YGImage.cc
46
+ YGInputField.cc
47
+ YGIntField.cc
48
+ YGLabel.cc
49
+ YGLayout.cc
50
+ YGMenuBar.cc
51
+ YGMenuButton.cc
52
+ YGPackageSelectorPluginStub.cc
53
+ YGProgressBar.cc
54
+ YGPushButton.cc
55
+ YGRadioButton.cc
56
+ YGSelectionStore.cc
57
+ YGText.cc
58
+ ygtkbargraph.c
59
+ ygtkfieldentry.c
60
+ ygtkfixed.c
61
+ ygtkhtmlwrap.c
62
+ ygtkimage.c
63
+ ygtklinklabel.c
64
+ ygtkmenubutton.c
65
+ ygtkratiobox.c
66
+ ygtkrichtext.c
67
+ ygtksteps.c
68
+ ygtktextview.c
69
+ ygtktimezonepicker.c
70
+ ygtktreeview.c
71
+ ygtkwindow.c
72
+ ygtkwizard.c
73
+ YGTreeView.cc
74
+ YGUI.cc
75
+ YGUtils.cc
76
+ YGWidget.cc
77
+ YGWizard.cc
78
+ )
79
+
80
+
81
+ set ( HEADERS
82
+ YGDialog.h
83
+ YGMenuBar.h
84
+ ygdkmngloader.h
85
+ YGi18n.h
86
+ YGPackageSelectorPluginIf.h
87
+ YGSelectionStore.h
88
+ ygtkbargraph.h
89
+ ygtkfieldentry.h
90
+ ygtkfixed.h
91
+ ygtkhtmlwrap.h
92
+ ygtkimage.h
93
+ ygtklinklabel.h
94
+ ygtkmenubutton.h
95
+ ygtkratiobox.h
96
+ ygtkrichtext.h
97
+ ygtksteps.h
98
+ ygtktextview.h
99
+ ygtktimezonepicker.h
100
+ ygtktreeview.h
101
+ ygtkwindow.h
102
+ ygtkwizard.h
103
+ YGUI.h
104
+ YGUtils.h
105
+ YGWidget.h
106
+ )
107
+
108
+
109
+ # Add shared lib to be built
110
+ add_library ( ${TARGETLIB} SHARED
111
+ ${SOURCES}
112
+ ${HEADERS}
113
+ )
114
+
115
+
116
+ # Include directories and compile options
117
+ #
118
+
119
+ set ( LOCAL_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} /include )
120
+
121
+ # Symlink ${YUI_INCLUDE_DIRS}
122
+ # so the headers there can be included as <yui/YFoo.h>
123
+ add_custom_target ( local-include -dir
124
+ # check if the symlink already exists
125
+ COMMAND if [ ! -L "${LOCAL_INCLUDE_DIR} /yui" ]\; then
126
+ rm -rf ${LOCAL_INCLUDE_DIR} \;
127
+ mkdir ${LOCAL_INCLUDE_DIR} \;
128
+ ln -s ${YUI_INCLUDE_DIRS} ${LOCAL_INCLUDE_DIR} /yui\;
129
+ fi
130
+ )
131
+
132
+ add_dependencies ( ${TARGETLIB} local-include -dir )
133
+ target_include_directories ( ${TARGETLIB} BEFORE PUBLIC ${LOCAL_INCLUDE_DIR} )
134
+
135
+ # Setup CMake to use GTK+, tell the compiler where to look for headers
136
+ # and to the linker where to look for libraries
137
+ INCLUDE_DIRECTORIES (${GTK3_INCLUDE_DIRS} ${YUI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} )
138
+ LINK_DIRECTORIES (${GTK3_LIBRARY_DIRS} ${YUI_LIBRARY_DIRS} )
139
+
140
+
141
+ # Make the version from ../../VERSION.cmake available as a #define
142
+ target_compile_definitions ( ${TARGETLIB} PUBLIC VERSION ="${VERSION} " )
143
+
144
+
145
+ #
146
+ # Linking
147
+ #
148
+
149
+ # Find yui during a combined build
150
+ target_link_directories ( ${TARGETLIB} BEFORE PUBLIC ../../libyui/build /src )
151
+
152
+
153
+ # Libraries that are needed to build this shared lib
154
+ #
155
+ # If in doubt what is really needed, check with "ldd -u" which libs are unused.
156
+ target_link_libraries ( ${TARGETLIB}
157
+ # yui
158
+ ${YUI_LIBRARIES}
159
+ ${GTK3_LIBRARIES}
160
+ )
161
+
162
+ # Notice that we don't link against Qt5::Svg, but we need it at runtime:
163
+ #
164
+ # It's a plugin for Qt and will be used to load SVGs (like our icons) if
165
+ # libQt5Svg is available. But we don't use it directly here, only via Qt
166
+ # classes like QPixmap and QIcon. Qt loads the SVG plugin as needed.
167
+
168
+
169
+ # https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties
170
+ set_target_properties ( ${TARGETLIB} PROPERTIES
171
+ VERSION ${SONAME} # From ../../VERSION.cmake
172
+ SOVERSION ${SONAME_MAJOR} # From ../../VERSION.cmake
173
+ OUTPUT_NAME ${TARGETLIB_BASE}
174
+ )
175
+
176
+
177
+ #
178
+ # Install
179
+ #
180
+
181
+ # Install the headers first so the message about the lib does not scroll away
182
+ install ( FILES ${HEADERS} DESTINATION ${HEADERS_INSTALL_DIR} )
183
+ install ( TARGETS ${TARGETLIB} LIBRARY DESTINATION ${PLUGIN_DIR} )
0 commit comments