This file is indexed.

/usr/share/cmake-3.5/Modules/KDE3Macros.cmake is in cmake-data 3.5.1-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
#

#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

# See FindKDE3.cmake for documentation.
#
# this file contains the following macros:
# KDE3_ADD_DCOP_SKELS
# KDE3_ADD_DCOP_STUBS
# KDE3_ADD_MOC_FILES
# KDE3_ADD_UI_FILES
# KDE3_ADD_KCFG_FILES
# KDE3_AUTOMOC
# KDE3_INSTALL_LIBTOOL_FILE
# KDE3_CREATE_FINAL_FILE
# KDE3_ADD_KPART
# KDE3_ADD_KDEINIT_EXECUTABLE
# KDE3_ADD_EXECUTABLE


#neundorf@kde.org

include(AddFileDependencies)

#create the kidl and skeletion file for dcop stuff
#usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers})
macro(KDE3_ADD_DCOP_SKELS _sources)
   foreach (_current_FILE ${ARGN})

      get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
      get_filename_component(_basename ${_tmp_FILE} NAME_WE)

      set(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp)
      set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)

      if (NOT HAVE_${_basename}_KIDL_RULE)
         set(HAVE_${_basename}_KIDL_RULE ON)

          add_custom_command(OUTPUT ${_kidl}
          COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
          ARGS ${_tmp_FILE} > ${_kidl}
          DEPENDS ${_tmp_FILE}
         )

       endif ()

      if (NOT HAVE_${_basename}_SKEL_RULE)
        set(HAVE_${_basename}_SKEL_RULE ON)

       add_custom_command(OUTPUT ${_skel}
          COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
          ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl}
          DEPENDS ${_kidl}
          )

      endif ()

      set(${_sources} ${${_sources}} ${_skel})

   endforeach ()

endmacro()


macro(KDE3_ADD_DCOP_STUBS _sources)
   foreach (_current_FILE ${ARGN})

      get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)

      get_filename_component(_basename ${_tmp_FILE} NAME_WE)

      set(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp)
      set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)

      if (NOT HAVE_${_basename}_KIDL_RULE)
        set(HAVE_${_basename}_KIDL_RULE ON)


        add_custom_command(OUTPUT ${_kidl}
           COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
           ARGS ${_tmp_FILE} > ${_kidl}
           DEPENDS ${_tmp_FILE}
           )

      endif ()


      if (NOT HAVE_${_basename}_STUB_RULE)
        set(HAVE_${_basename}_STUB_RULE ON)

        add_custom_command(OUTPUT ${_stub_CPP}
           COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
           ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl}
           DEPENDS ${_kidl}
         )

      endif ()

      set(${_sources} ${${_sources}} ${_stub_CPP})

   endforeach ()

endmacro()


macro(KDE3_ADD_KCFG_FILES _sources)
   foreach (_current_FILE ${ARGN})

      get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)

      get_filename_component(_basename ${_tmp_FILE} NAME_WE)

      file(READ ${_tmp_FILE} _contents)
      string(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2"  _kcfg_FILE "${_contents}")

      set(_src_FILE    ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
      set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)

      add_custom_command(OUTPUT ${_src_FILE}
         COMMAND ${KDE3_KCFGC_EXECUTABLE}
         ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE}
         DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} )

      set(${_sources} ${${_sources}} ${_src_FILE})

   endforeach ()

endmacro()


#create the moc files and add them to the list of sources
#usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers})
macro(KDE3_ADD_MOC_FILES _sources)
   foreach (_current_FILE ${ARGN})

      get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)

      get_filename_component(_basename ${_tmp_FILE} NAME_WE)
      set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)

      add_custom_command(OUTPUT ${_moc}
         COMMAND ${QT_MOC_EXECUTABLE}
         ARGS ${_tmp_FILE} -o ${_moc}
         DEPENDS ${_tmp_FILE}
      )

      set(${_sources} ${${_sources}} ${_moc})

   endforeach ()
endmacro()


get_filename_component( KDE3_MODULE_DIR  ${CMAKE_CURRENT_LIST_FILE} PATH)

#create the implementation files from the ui files and add them to the list of sources
#usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files})
macro(KDE3_ADD_UI_FILES _sources )
   foreach (_current_FILE ${ARGN})

      get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)

      get_filename_component(_basename ${_tmp_FILE} NAME_WE)
      set(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
      set(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
      set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)

      add_custom_command(OUTPUT ${_header}
         COMMAND ${QT_UIC_EXECUTABLE}
         ARGS  -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
         DEPENDS ${_tmp_FILE}
      )

      add_custom_command(OUTPUT ${_src}
         COMMAND ${CMAKE_COMMAND}
         ARGS
         -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer
         -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
         -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
         -DKDE_UIC_CPP_FILE:FILEPATH=${_src}
         -DKDE_UIC_H_FILE:FILEPATH=${_header}
         -P ${KDE3_MODULE_DIR}/kde3uic.cmake
         DEPENDS ${_header}
      )

      add_custom_command(OUTPUT ${_moc}
         COMMAND ${QT_MOC_EXECUTABLE}
         ARGS ${_header} -o ${_moc}
         DEPENDS ${_header}
      )

      set(${_sources} ${${_sources}} ${_src} ${_moc} )

   endforeach ()
endmacro()


macro(KDE3_AUTOMOC)
   set(_matching_FILES )
   foreach (_current_FILE ${ARGN})

      get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)

      # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
      # here. this is required to make bouic work correctly:
      # we need to add generated .cpp files to the sources (to compile them),
      # but we cannot let automoc handle them, as the .cpp files don't exist yet when
      # cmake is run for the very first time on them -> however the .cpp files might
      # exist at a later run. at that time we need to skip them, so that we don't add two
      # different rules for the same moc file
      get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC)

      if (EXISTS ${_abs_FILE} AND NOT _skip)

         file(STRINGS ${_abs_FILE} _match REGEX "#include +[^ ]+\\.moc[\">]")

         get_filename_component(_abs_PATH ${_abs_FILE} PATH)

         foreach (_current_MOC_INC IN LISTS _match)
            string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")

            get_filename_component(_basename ${_current_MOC} NAME_WE)
#            set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
            set(_header ${_abs_PATH}/${_basename}.h)
            set(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})

            add_custom_command(OUTPUT ${_moc}
               COMMAND ${QT_MOC_EXECUTABLE}
               ARGS ${_header} -o ${_moc}
               DEPENDS ${_header}
            )

            ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})

         endforeach ()
         unset(_match)
         unset(_header)
         unset(_moc)
      endif ()
   endforeach ()
endmacro()

# only used internally by KDE3_INSTALL_ICONS
macro (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME)

   # if the string doesn't match the pattern, the result is the full string, so all three have the same content
   if (NOT ${_group} STREQUAL ${_install_NAME} )
      set(_icon_GROUP "actions")

      if (${_group} STREQUAL "mime")
         set(_icon_GROUP  "mimetypes")
      endif ()

      if (${_group} STREQUAL "filesys")
         set(_icon_GROUP  "filesystems")
      endif ()

      if (${_group} STREQUAL "device")
         set(_icon_GROUP  "devices")
      endif ()

      if (${_group} STREQUAL "app")
         set(_icon_GROUP  "apps")
      endif ()

      if (${_group} STREQUAL "action")
         set(_icon_GROUP  "actions")
      endif ()

#      message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
   install(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} )
   endif ()

endmacro ()


macro (KDE3_INSTALL_ICONS _theme )
   set(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons")
   # first the png icons
   file(GLOB _icons *.png)
   foreach (_current_ICON ${_icons} )
      string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size  "${_current_ICON}")
      string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
      string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name  "${_current_ICON}")
      _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
         ${_defaultpath}/${_theme}/${_size}x${_size}
         ${_group} ${_current_ICON} ${_name})
   endforeach ()

   # and now the svg icons
   file(GLOB _icons *.svgz)
   foreach (_current_ICON ${_icons} )
      string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}")
      string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}")
      _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
                                 ${_defaultpath}/${_theme}/scalable
                                 ${_group} ${_current_ICON} ${_name})
   endforeach ()

endmacro ()

macro(KDE3_INSTALL_LIBTOOL_FILE _target)
   get_target_property(_target_location ${_target} LOCATION)

   get_filename_component(_laname ${_target_location} NAME_WE)
   get_filename_component(_soname ${_target_location} NAME)
   set(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)

   file(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
   file(APPEND ${_laname} "# The name that we can dlopen(3).\n")
   file(APPEND ${_laname} "dlname='${_soname}'\n")
   file(APPEND ${_laname} "# Names of this library\n")
   if(CYGWIN)
     file(APPEND ${_laname} "library_names='${_soname}'\n")
   else()
     file(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n")
   endif()
   file(APPEND ${_laname} "# The name of the static archive\n")
   file(APPEND ${_laname} "old_library=''\n")
   file(APPEND ${_laname} "# Libraries that this one depends upon.\n")
   file(APPEND ${_laname} "dependency_libs=''\n")
#   file(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n")
   file(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
   file(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n")
   file(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
   file(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n")
   file(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
   file(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n")

   install_files(${KDE3_LIBTOOL_DIR} FILES ${_laname})
endmacro()


macro(KDE3_CREATE_FINAL_FILE _filename)
   file(WRITE ${_filename} "//autogenerated file\n")
   foreach (_current_FILE ${ARGN})
      file(APPEND ${_filename} "#include \"${_current_FILE}\"\n")
   endforeach ()

endmacro()


# option(KDE3_ENABLE_FINAL "Enable final all-in-one compilation")
option(KDE3_BUILD_TESTS  "Build the tests")


macro(KDE3_ADD_KPART _target_NAME _with_PREFIX)
#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty
   if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
      set(_first_SRC)
   else ()
      set(_first_SRC ${_with_PREFIX})
   endif ()

#    if (KDE3_ENABLE_FINAL)
#       KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN})
#       add_library(${_target_NAME} MODULE  ${_target_NAME}_final.cpp)
#    else ()
   add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
#    endif ()

   if(_first_SRC)
      set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
   endif()

   KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME})

endmacro()


macro(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME )

#    if (KDE3_ENABLE_FINAL)
#       KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
#       add_library(kdeinit_${_target_NAME} SHARED  ${_target_NAME}_final.cpp)
#    else ()
   add_library(kdeinit_${_target_NAME} SHARED ${ARGN} )
#    endif ()

   configure_file(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)

   add_executable( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp )
   target_link_libraries( ${_target_NAME} kdeinit_${_target_NAME} )

endmacro()


macro(KDE3_ADD_EXECUTABLE _target_NAME )

#    if (KDE3_ENABLE_FINAL)
#       KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
#       add_executable(${_target_NAME} ${_target_NAME}_final.cpp)
#    else ()
   add_executable(${_target_NAME} ${ARGN} )
#    endif ()

endmacro()