Add version info to dbus-1 target for non msvc builds on Windows too
[platform/upstream/dbus.git] / cmake / tools / CMakeLists.txt
1 add_definitions("-DDBUS_COMPILATION")
2
3 set (dbus_send_SOURCES
4         ../../tools/dbus-print-message.c                        
5         ../../tools/dbus-print-message.h                        
6         ../../tools/dbus-send.c
7         ../../tools/tool-common.c
8         ../../tools/tool-common.h
9 )
10
11 set (dbus_monitor_SOURCES
12         ../../tools/dbus-monitor.c                              
13         ../../tools/dbus-print-message.c                        
14         ../../tools/dbus-print-message.h
15         ../../tools/tool-common.c
16         ../../tools/tool-common.h
17 )
18
19 set (dbus_test_tool_SOURCES
20         ../../tools/dbus-echo.c
21         ../../tools/dbus-spam.c
22         ../../tools/tool-common.c
23         ../../tools/tool-common.h
24         ../../tools/test-tool.c
25         ../../tools/test-tool.h
26 )
27
28 set (dbus_update_activation_environment_SOURCES
29         ../../tools/dbus-update-activation-environment.c
30         ../../tools/tool-common.c
31         ../../tools/tool-common.h
32 )
33
34 if (WIN32)
35 set (dbus_launch_SOURCES
36         ../../tools/dbus-launch-win.c
37 )
38 else (WIN32)
39 set (dbus_launch_SOURCES
40         ../../tools/dbus-launch.c
41         ../../tools/tool-common.c
42         ../../tools/tool-common.h
43 )
44 endif (WIN32)
45
46 if (DBUS_BUILD_X11)
47 set (dbus_launch_SOURCES
48      ${dbus_launch_SOURCES}
49      ../../tools/dbus-launch-x11.c
50 )
51 endif(DBUS_BUILD_X11)
52
53 set (dbus_cleanup_sockets_SOURCES
54         ../../tools/dbus-cleanup-sockets.c
55 )
56
57 add_executable(dbus-send ${dbus_send_SOURCES})
58 target_link_libraries(dbus-send ${DBUS_LIBRARIES})
59 install(TARGETS dbus-send ${INSTALL_TARGETS_DEFAULT_ARGS})
60
61 add_executable(dbus-test-tool ${dbus_test_tool_SOURCES})
62 target_link_libraries(dbus-test-tool ${DBUS_LIBRARIES})
63 install(TARGETS dbus-test-tool ${INSTALL_TARGETS_DEFAULT_ARGS})
64
65 if(WIN32)
66     # avoid dbus-update-activation-environment triggering UAC
67     # 1 is the resource ID, ID_MANIFEST
68     # 24 is the resource type, RT_MANIFEST
69     # constants are used because of a bug in windres
70     # see https://stackoverflow.com/questions/33000158/embed-manifest-file-to-require-administrator-execution-level-with-mingw32
71     file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/disable-uac.rc "1 24 \"${CMAKE_SOURCE_DIR}/../tools/Win32.Manifest\"\n")
72     list(APPEND dbus_update_activation_environment_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/disable-uac.rc)
73 endif()
74 add_executable(dbus-update-activation-environment ${dbus_update_activation_environment_SOURCES})
75 target_link_libraries(dbus-update-activation-environment ${DBUS_LIBRARIES})
76 install(TARGETS dbus-update-activation-environment ${INSTALL_TARGETS_DEFAULT_ARGS})
77
78 add_executable(dbus-launch ${dbus_launch_SOURCES})
79 target_link_libraries(dbus-launch ${DBUS_LIBRARIES})
80 if (DBUS_BUILD_X11)
81   target_link_libraries(dbus-launch ${X11_LIBRARIES} )
82 endif (DBUS_BUILD_X11)
83 install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS})
84
85 add_executable(dbus-monitor ${dbus_monitor_SOURCES})
86 target_link_libraries(dbus-monitor ${DBUS_LIBRARIES})
87 install(TARGETS dbus-monitor ${INSTALL_TARGETS_DEFAULT_ARGS})
88
89 # create the /var/lib/dbus directory for dbus-uuidgen
90 install(DIRECTORY DESTINATION var/lib/dbus)