2 cmake_minimum_required( VERSION 2.6 )
4 include( FindPkgConfig )
5 include( CheckLibraryExists )
6 pkg_check_modules( X11 REQUIRED x11 xcomposite xdamage xinerama xrender xrandr>=1.3 )
7 pkg_check_modules( PANGOCAIRO REQUIRED pangocairo )
8 pkg_check_modules( PANGO REQUIRED pango )
9 pkg_check_modules( CAIRO REQUIRED cairo )
10 pkg_check_modules( GLIB2 REQUIRED glib-2.0 )
11 pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
12 pkg_check_modules( IMLIB2 REQUIRED imlib2>=1.4.2 )
13 pkg_check_modules( SN libstartup-notification-1.0>=0.12 )
14 find_library( RT_LIBRARY rt )
16 if( NOT X11_FOUND OR NOT PANGOCAIRO_FOUND OR NOT PANGO_FOUND OR NOT CAIRO_FOUND OR NOT GLIB2_FOUND OR NOT GOBJECT2_FOUND OR NOT IMLIB2_FOUND )
17 message( FATAL_ERROR "Not all dependencies fulfilled. See http://code.google.com/p/tint2/wiki/Install" )
18 endif( NOT X11_FOUND OR NOT PANGOCAIRO_FOUND OR NOT PANGO_FOUND OR NOT CAIRO_FOUND OR NOT GLIB2_FOUND OR NOT GOBJECT2_FOUND OR NOT IMLIB2_FOUND )
20 string( REPLACE ";" " " FLAGS_REPLACED "${IMLIB2_LDFLAGS}" )
21 set( CMAKE_REQUIRED_FLAGS "${FLAGS_REPLACED}" )
22 check_library_exists( "${IMLIB2_LIBRARIES}" "imlib_context_set_display" "${IMLIB2_LIBRARY_DIRS}" IMLIB_BUILD_WITH_X )
23 if( NOT IMLIB_BUILD_WITH_X )
24 message( FATAL_ERROR "Imlib is not build with x support" )
25 endif( NOT IMLIB_BUILD_WITH_X )
27 include_directories( ${PROJECT_BINARY_DIR}
38 ${PANGOCAIRO_INCLUDE_DIRS}
42 ${GOBJECT2_INCLUDE_DIRS}
43 ${IMLIB2_INCLUDE_DIRS}
46 set( SOURCES src/config.c
51 src/systray/systraybar.c
52 src/launcher/launcher.c
53 src/launcher/xsettings-client.c
54 src/launcher/xsettings-common.c
57 src/taskbar/taskbarname.c
59 src/freespace/freespace.c
65 option( ENABLE_BATTERY "Enable battery status plugin" ON )
66 option( ENABLE_TINT2CONF "Enable tint2conf build, a GTK+2 theme switcher for tint2" ON )
67 option( ENABLE_EXAMPLES "Install additional tin2rc examples" OFF )
68 option( ENABLE_SN "Startup notification support" ON )
71 add_definitions( -DHAVE_SN -DSN_API_NOT_YET_FROZEN )
76 set( SOURCES ${SOURCES} src/battery/battery.c )
77 add_definitions( -DENABLE_BATTERY )
78 endif( ENABLE_BATTERY )
80 set( MANDIR share/man CACHE PATH "Directory for man pages" )
81 set( DATADIR share CACHE PATH "Directory for shared data" )
82 set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
83 set( DOCDIR share/doc/tint2 CACHE PATH "Directory for documentation files" )
85 if( ENABLE_TINT2CONF )
86 add_definitions( -DHAVE_VERSION_H )
87 add_subdirectory( src/tint2conf )
88 add_dependencies( tint2conf version )
89 endif( ENABLE_TINT2CONF )
91 add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_svnrev.sh" "\"${PROJECT_SOURCE_DIR}\"" )
93 link_directories( ${X11_LIBRARY_DIRS}
94 ${PANGOCAIRO_LIBRARY_DIRS}
98 ${GOBJECT2_LIBRARY_DIRS}
99 ${IMLIB2_LIBRARY_DIRS}
101 add_executable(tint2 ${SOURCES})
102 target_link_libraries( tint2 ${X11_LIBRARIES}
103 ${PANGOCAIRO_LIBRARIES}
107 ${GOBJECT2_LIBRARIES}
111 target_link_libraries( tint2 ${RT_LIBRARY} )
114 add_dependencies( tint2 version )
115 set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -pthread" )
116 set_target_properties(tint2 PROPERTIES LINK_FLAGS "-pthread" )
118 install( TARGETS tint2 DESTINATION bin )
119 install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )
120 install( FILES default_icon.png DESTINATION ${DATADIR}/tint2 )
121 install( FILES AUTHORS ChangeLog README DESTINATION ${DOCDIR} )
122 install( FILES doc/tint2.1 DESTINATION ${MANDIR}/man1 )
123 if( ENABLE_EXAMPLES )
124 file( GLOB SAMPLEFILES sample/*.tint2rc )
125 install( FILES ${SAMPLEFILES} DESTINATION ${DOCDIR}/examples )
126 endif( ENABLE_EXAMPLES )