not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / libs / ksysguard / processui / CMakeLists.txt
blobf6ab5768f25ebd408f90e29761f30683385da6f5
2 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../  ../processcore/)
4 check_include_files(sys/ptrace.h HAVE_SYS_PTRACE_H)
5 check_include_files(sys/endian.h HAVE_SYS_ENDIAN_H)
6 check_include_files(byteswap.h HAVE_BYTESWAP_H)
8 if (HAVE_SYS_PTRACE_H)
9    set(_SUPPORTED_REGS_STRUCT_CHECK "
10    #include <sys/user.h>
11    #include <sys/syscall.h>
13    #if defined(__i386__)
14    #  define _regs_struct user_regs_struct
15    #  define REG_ORIG_ACCUM orig_eax
16    #elif defined( __amd64__)
17    #  define _regs_struct user_regs_struct
18    #  define REG_ORIG_ACCUM orig_rax
19    #elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__PPC__) || defined(powerpc)
20    #  define _regs_struct pt_regs;
21    #  define REG_ORIG_ACCUM gpr[0]
22    #endif
24    int main() {
25      struct _regs_struct* regs;
26      return regs->REG_ORIG_ACCUM == SYS_fork;
27    }")
29    include(CheckCSourceCompiles)
30    check_c_source_compiles("${_SUPPORTED_REGS_STRUCT_CHECK}" HAVE_KSYSGUARD_SUPPORTED_REGS_STRUCT)
31 else (HAVE_SYS_PTRACE_H)
32    # Even if we don't have ptrace, we need KMonitorProcessIO.cpp
33    # because the widget is referenced from the .widgets file and
34    # from the .ui files.
35    set(HAVE_KSYSGUARD_SUPPORTED_REGS_STRUCT "NO")
36 endif (HAVE_SYS_PTRACE_H)
38 if (HAVE_KSYSGUARD_SUPPORTED_REGS_STRUCT)
39    add_definitions(-DWITH_MONITOR_PROCESS_IO)
40    set(processui_ptrace_SRCS KMonitorProcessIO.cpp DisplayProcessDlg.cpp)
41    set(ksysguard_WIDGETS "${CMAKE_CURRENT_BINARY_DIR}/ksysguard.generated_widgets")
43    # Merge both widget files
44    file(READ ksysguard.widgets _ksysguard_buffer)
45    file(WRITE ${ksysguard_WIDGETS} "${_ksysguard_buffer}")
46    file(READ KMonitorProcessIO.widgets _ksysguard_buffer)
47    file(APPEND ${ksysguard_WIDGETS} "${_ksysguard_buffer}")
48 else (HAVE_KSYSGUARD_SUPPORTED_REGS_STRUCT)
49    set(processui_ptrace_SRCS )
50    set(ksysguard_WIDGETS "ksysguard.widgets")
51 endif (HAVE_KSYSGUARD_SUPPORTED_REGS_STRUCT)
53 set(processui_LIB_SRCS
54    ksysguardprocesslist.cpp
55    ProcessFilter.cc
56    ProcessModel.cc
57    ReniceDlg.cc
58    KTextEditVT.cpp
59    ${processui_ptrace_SRCS}
62 kde4_add_ui_files( processui_LIB_SRCS
63    ReniceDlgUi.ui
64    ProcessWidgetUI.ui
65    DisplayProcessUi.ui
69 kde4_add_library(processui SHARED ${processui_LIB_SRCS})
71 target_link_libraries(processui ${KDE4_KDEUI_LIBS} processcore)
72 target_link_libraries(processui LINK_INTERFACE_LIBRARIES ${KDE4_KDEUI_LIBS} processcore)
74 set_target_properties(processui
75    PROPERTIES VERSION ${GENERIC_LIB_VERSION}
76    SOVERSION ${GENERIC_LIB_SOVERSION}
77    )
79 install(TARGETS processui EXPORT kdeworkspaceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
81 #----------------------
83 kde4_add_widget_files(ksysguardwidgets_PART_SRCS ${ksysguard_WIDGETS})
85 kde4_add_plugin(ksysguardwidgets ${ksysguardwidgets_PART_SRCS})
87 target_link_libraries(ksysguardwidgets ${KDE4_KDEUI_LIBS} processui)
89 install(TARGETS ksysguardwidgets DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/designer )
91 install( FILES ProcessModel.h DisplayProcessDlg.h ProcessFilter.h KTextEditVT.h ksysguardprocesslist.h DESTINATION ${INCLUDE_INSTALL_DIR}/ksysguard COMPONENT Devel)