cmake: consolidate version strings

This commit is contained in:
Michael Gehring 2008-06-22 16:59:56 +02:00 committed by Julien Danjou
parent 46f03fd6a6
commit 9206a60e88
6 changed files with 15 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#ifndef _AWE_VERSION_INTERNAL_H_ #ifndef _AWE_VERSION_INTERNAL_H_
#define _AWE_VERSION_INTERNAL_H_ #define _AWE_VERSION_INTERNAL_H_
#define AWESOME_VERSION_INTERNAL "@AWESOME_VERSION_INTERNAL@" #define AWESOME_VERSION "@AWESOME_VERSION@"
#define AWESOME_COMPILE_MACHINE "@AWESOME_COMPILE_MACHINE@" #define AWESOME_COMPILE_MACHINE "@AWESOME_COMPILE_MACHINE@"
#define AWESOME_COMPILE_BY "@AWESOME_COMPILE_BY@" #define AWESOME_COMPILE_BY "@AWESOME_COMPILE_BY@"
#define AWESOME_COMPILE_HOSTNAME "@AWESOME_COMPILE_HOSTNAME@" #define AWESOME_COMPILE_HOSTNAME "@AWESOME_COMPILE_HOSTNAME@"

View File

@ -161,7 +161,7 @@ ENDIF()
IF(DEFINED PREFIX) IF(DEFINED PREFIX)
SET(CMAKE_INSTALL_PREFIX ${PREFIX}) SET(CMAKE_INSTALL_PREFIX ${PREFIX})
ENDIF() ENDIF()
SET(AWESOME_VERSION_INTERNAL devel ) SET(AWESOME_VERSION ${VERSION} )
SET(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} ) SET(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} )
SET(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} ) SET(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} )
SET(AWESOME_COMPILE_BY $ENV{USER} ) SET(AWESOME_COMPILE_BY $ENV{USER} )

View File

@ -32,7 +32,7 @@
void void
eprint_version(const char *const executable) eprint_version(const char *const executable)
{ {
printf("%s (awesome) " AWESOME_VERSION_INTERNAL printf("%s (awesome) " AWESOME_VERSION
" (" AWESOME_RELEASE ")\n" " (" AWESOME_RELEASE ")\n"
"built", "built",
executable); executable);
@ -50,4 +50,13 @@ eprint_version(const char *const executable)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
/** Get version string.
* \return A string describing the current version.
*/
const char*
version_string(void)
{
return AWESOME_VERSION;
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -23,5 +23,6 @@
#define AWESOME_COMMON_VERSION_H #define AWESOME_COMMON_VERSION_H
void eprint_version(const char *const executable) __attribute__ ((noreturn)); void eprint_version(const char *const executable) __attribute__ ((noreturn));
const char *version_string(void);
#endif #endif

View File

@ -1,10 +1,8 @@
#ifndef _CONFIG_H_ #ifndef _CONFIG_H_
#define _CONFIG_H_ #define _CONFIG_H_
#define AWESOME_RELEASE "@AWESOME_RELEASE@"
#define AWESOME_LUA_LIB_PATH "@AWESOME_LUA_LIB_PATH@" #define AWESOME_LUA_LIB_PATH "@AWESOME_LUA_LIB_PATH@"
#define AWESOME_CONF_PATH "@AWESOME_CONF_PATH@" #define AWESOME_CONF_PATH "@AWESOME_CONF_PATH@"
#define VERSION "@VERSION@"
#cmakedefine WITH_DBUS #cmakedefine WITH_DBUS
#cmakedefine WITH_IMLIB2 #cmakedefine WITH_IMLIB2

3
lua.c
View File

@ -45,6 +45,7 @@
#include "screen.h" #include "screen.h"
#include "layouts/tile.h" #include "layouts/tile.h"
#include "common/socket.h" #include "common/socket.h"
#include "common/version.h"
extern awesome_t globalconf; extern awesome_t globalconf;
@ -540,7 +541,7 @@ luaA_init(void)
luaA_openlib(L, "keybinding", awesome_keybinding_methods, awesome_keybinding_meta); luaA_openlib(L, "keybinding", awesome_keybinding_methods, awesome_keybinding_meta);
lua_pushliteral(L, "AWESOME_VERSION"); lua_pushliteral(L, "AWESOME_VERSION");
lua_pushliteral(L, VERSION); lua_pushstring(L, version_string());
lua_settable(L, LUA_GLOBALSINDEX); lua_settable(L, LUA_GLOBALSINDEX);
luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\""); luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\"");