*add* include svn revision in the VERSION_STRING if building with cmake

git-svn-id: http://tint2.googlecode.com/svn/trunk@475 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
Andreas.Fink85 2010-06-09 15:31:18 +00:00
parent f8889fdbe0
commit abeb6d384d
5 changed files with 41 additions and 5 deletions

View file

@ -16,7 +16,8 @@ if( NOT IMLIB_BUILD_WITH_X )
message( FATAL_ERROR "Imlib is not build with x support" ) message( FATAL_ERROR "Imlib is not build with x support" )
endif( NOT IMLIB_BUILD_WITH_X ) endif( NOT IMLIB_BUILD_WITH_X )
include_directories( src include_directories( ${PROJECT_BINARY_DIR}
src
src/battery src/battery
src/clock src/clock
src/systray src/systray
@ -55,7 +56,9 @@ if( ENABLE_BATTERY )
endif( ENABLE_BATTERY ) endif( ENABLE_BATTERY )
if( ENABLE_TINT2CONF ) if( ENABLE_TINT2CONF )
add_definitions( -DBUILD_CMAKE )
add_subdirectory( src/tint2conf ) add_subdirectory( src/tint2conf )
add_dependencies( tint2conf version )
endif( ENABLE_TINT2CONF ) endif( ENABLE_TINT2CONF )
@ -64,6 +67,8 @@ set( DATADIR ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "Directory for shared data
set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" ) set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
set( DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/tint2 CACHE PATH "Directory for documentation files" ) set( DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/tint2 CACHE PATH "Directory for documentation files" )
add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_svnrev.sh" "\"${PROJECT_SOURCE_DIR}\"" )
add_executable(tint2 ${SOURCES}) add_executable(tint2 ${SOURCES})
link_directories( ${X11_LIBRARY_DIRS} link_directories( ${X11_LIBRARY_DIRS}
${X11_LIBRARY_DIRS} ${X11_LIBRARY_DIRS}
@ -82,6 +87,7 @@ target_link_libraries( tint2 ${X11_LIBRARIES}
${IMLIB2_LIBRARIES} ${IMLIB2_LIBRARIES}
rt ) rt )
add_dependencies(tint2 version)
set_target_properties(tint2 PROPERTIES COMPILE_FLAGS -Wall) set_target_properties(tint2 PROPERTIES COMPILE_FLAGS -Wall)
set_target_properties(tint2 PROPERTIES LINK_FLAGS -Wl,--as-needed) set_target_properties(tint2 PROPERTIES LINK_FLAGS -Wl,--as-needed)

28
get_svnrev.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
FALLBACK="0.10-svn"
if [[ $# -eq 0 ]]; then
DIR=.
else
DIR=$1
fi
if [[ -f version.h ]]; then
REV_OLD=$(cat version.h | cut -d" " -f3)
else
REV_OLD=""
fi
if [[ -x "$(which svnversion 2>/dev/null)" && -d "${DIR}/.svn" ]] ; then
REV=\"$(svnversion -n ${DIR})\"
else
REV=${FALLBACK}
fi
if [[ ${REV_OLD} != ${REV} ]]; then
echo "Building new version.h"
echo "#define VERSION_STRING "${REV}"" > version.h
fi

View file

@ -436,7 +436,6 @@ gboolean add_icon(Window id)
XSendEvent(server.dsp, id, False, 0xFFFFFF, &e); XSendEvent(server.dsp, id, False, 0xFFFFFF, &e);
} }
printf("Adding systray with window: %d\n", id);
traywin = g_new0(TrayWindow, 1); traywin = g_new0(TrayWindow, 1);
traywin->id = parent_window; traywin->id = parent_window;
traywin->tray_id = id; traywin->tray_id = id;
@ -477,7 +476,6 @@ void remove_icon(TrayWindow *traywin)
{ {
XErrorHandler old; XErrorHandler old;
printf("Removing systray with window: %d\n", traywin->tray_id);
// remove from our list // remove from our list
systray.list_icons = g_slist_remove(systray.list_icons, traywin); systray.list_icons = g_slist_remove(systray.list_icons, traywin);
systray.area.resize = 1; systray.area.resize = 1;

View file

@ -31,7 +31,7 @@
#include <Imlib2.h> #include <Imlib2.h>
#include <signal.h> #include <signal.h>
#include "version.h" #include <version.h>
#include "server.h" #include "server.h"
#include "window.h" #include "window.h"
#include "config.h" #include "config.h"

View file

@ -28,7 +28,11 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include "../version.h" #ifdef BUILD_CMAKE
#include "version.h"
#else
#include "../version.h"
#endif
#include "common.h" #include "common.h"
#include "theme_view.h" #include "theme_view.h"