From: Andreas Fink Date: Wed, 9 Jun 2010 09:14:56 +0000 (+0000) Subject: *add* make CMakeLists.txt equivalent to the autoconf behaviour X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=5ed667450b58aee80bd200dcbb7249e4203fc02f;p=chaz%2Ftint2 *add* make CMakeLists.txt equivalent to the autoconf behaviour --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a3fb2bc..364af41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ -project(tint2) -cmake_minimum_required(VERSION 2.6) +project( tint2 ) +cmake_minimum_required( VERSION 2.6 ) include( FindPkgConfig ) +include( CheckFunctionExists ) pkg_check_modules( X11 REQUIRED x11 xcomposite xdamage xinerama xrender xrandr ) pkg_check_modules( PANGOCAIRO REQUIRED pangocairo ) pkg_check_modules( PANGO REQUIRED pango ) @@ -10,6 +11,12 @@ pkg_check_modules( GLIB2 REQUIRED glib-2.0 ) pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 ) pkg_check_modules( IMLIB2 REQUIRED imlib2 ) +set( CMAKE_REQUIRED_FLAGS ${IMLIB2_LDFLAGS} ${IMLIB2_CFLAGS} ) +check_function_exists( imlib_context_set_display IMLIB_BUILD_WITH_X ) +if( NOT IMLIB_BUILD_WITH_X ) + message( FATAL_ERROR "Imlib is not build with x support" ) +endif( NOT IMLIB_BUILD_WITH_X ) + include_directories( src src/battery src/clock @@ -25,33 +32,48 @@ include_directories( src ${GOBJECT2_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS} ) -set(SOURCES src/config.c - src/panel.c - src/server.c - src/tint.c - src/clock/clock.c - src/systray/systraybar.c - src/taskbar/task.c - src/taskbar/taskbar.c - src/tooltip/tooltip.c - src/util/area.c - src/util/common.c - src/util/timer.c - src/util/window.c ) +set( SOURCES src/config.c + src/panel.c + src/server.c + src/tint.c + src/clock/clock.c + src/systray/systraybar.c + src/taskbar/task.c + src/taskbar/taskbar.c + src/tooltip/tooltip.c + src/util/area.c + src/util/common.c + src/util/timer.c + src/util/window.c ) + +option( DISABLE_BATTERY "Disable battery status plugin" OFF ) +option( DISABLE_TINT2CONF "Disable tint2conf build, a GTK+2 theme switcher for tint2" OFF ) +option( ENABLE_EXAMPLES "Install additional tin2rc examples" OFF ) -option( ENABLE_BATTERY "Enable battery support in tint2" OFF ) -if ( ENABLE_BATTERY ) +if( NOT DISABLE_BATTERY ) set( SOURCES ${SOURCES} src/battery/battery.c ) add_definitions( -DENABLE_BATTERY ) -endif( ENABLE_BATTERY ) +endif( NOT DISABLE_BATTERY ) -option( ENABLE_TINT2CONF "Enable tint2conf. A tint2 theme switcher" ON ) -if ( ENABLE_TINT2CONF ) +if( NOT DISABLE_TINT2CONF ) add_subdirectory( src/tint2conf ) -endif( ENABLE_TINT2CONF ) +endif( NOT DISABLE_TINT2CONF ) +set( MANDIR ${CMAKE_INSTALL_PREFIX}/share/man CACHE PATH "Directory for man pages" ) +set( DATADIR ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "Directory for shared data" ) +set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" ) +set( DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/tint2 CACHE PATH "Directory for documentation files" ) + add_executable(tint2 ${SOURCES}) +link_directories( ${X11_LIBRARY_DIRS} + ${X11_LIBRARY_DIRS} + ${PANGOCAIRO_LIBRARY_DIRS} + ${PANGO_LIBRARY_DIRS} + ${CAIRO_LIBRARY_DIRS} + ${GLIB2_LIBRARY_DIRS} + ${GOBJECT2_LIBRARY_DIRS} + ${IMLIB2_LIBRARY_DIRS} ) target_link_libraries( tint2 ${X11_LIBRARIES} ${PANGOCAIRO_LIBRARIES} ${PANGO_LIBRARIES} @@ -61,4 +83,13 @@ target_link_libraries( tint2 ${X11_LIBRARIES} ${IMLIB2_LIBRARIES} rt ) -install(TARGETS tint2 DESTINATION bin) +set_target_properties(tint2 PROPERTIES COMPILE_FLAGS -Wall) +set_target_properties(tint2 PROPERTIES LINK_FLAGS -Wl,--as-needed) + +install( TARGETS tint2 DESTINATION bin ) +install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 ) +install( FILES AUTHORS ChangeLog README DESTINATION ${DOCDIR} ) +if( ENABLE_EXAMPLES ) + file( GLOB SAMPLEFILES sample/*.tint2rc ) + install( FILES ${SAMPLEFILES} DESTINATION ${DOCDIR}/examples ) +endif( ENABLE_EXAMPLES ) diff --git a/src/tint2conf/CMakeLists.txt b/src/tint2conf/CMakeLists.txt index e3e02e1..c092ecc 100644 --- a/src/tint2conf/CMakeLists.txt +++ b/src/tint2conf/CMakeLists.txt @@ -28,4 +28,8 @@ target_link_libraries( tint2conf ${X11_LIBRARIES} ${GTHREAD2_LIBRARIES} ${GTK2_LIBRARIES} ) +set_target_properties(tint2conf PROPERTIES COMPILE_FLAGS -Wall) +set_target_properties(tint2conf PROPERTIES LINK_FLAGS -Wl,--as-needed) + install( TARGETS tint2conf DESTINATION bin ) +install( PROGRAMS tintwizard.py DESTINATION bin )