From: Ralf Habacker Date: Sun, 6 Dec 2009 23:49:42 +0000 (+0100) Subject: fixed cmake version macro and string handling X-Git-Tag: dbus-1.3.1~134 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=492e0ae06a000469ff04ebc567ad7039f7d173e5;p=thirdparty%2Fdbus.git fixed cmake version macro and string handling --- diff --git a/bus/main.c b/bus/main.c index edb6d95e0..45e08f0fa 100644 --- a/bus/main.c +++ b/bus/main.c @@ -85,7 +85,7 @@ version (void) "Copyright (C) 2002, 2003 Red Hat, Inc., CodeFactory AB, and others\n" "This is free software; see the source for copying conditions.\n" "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - VERSION); + DBUS_VERSION_STRING); exit (0); } diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 66b0e0e22..e623e2df3 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,23 +1,14 @@ -set (PACKAGE dbus) - -# the version major, minor and release number should be synchron to the dbus cvs - windows releases should only update the patch level -set (VERSION_MAJOR "1") -set (VERSION_MINOR "3") -set (VERSION_RELEASE "1") -set (VERSION_PATCH "0") -if (VERSION_PATCH) - set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}-${VERSION_PATCH}" ) -else (VERSION_PATCH) - set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}" ) -endif (VERSION_PATCH) -set (DBUS_MAJOR_VERSION ${VERSION_MAJOR}) -set (DBUS_MINOR_VERSION ${VERSION_MAJOR}) -set (DBUS_MICRO_VERSION ${VERSION_MAJOR}) -set (DBUS_MAJOR_VERSION ${VERSION_MAJOR}) -set (DBUS_VERSION ${VERSION}) -set (DBUS_VERSION_STRING "${VERSION}") - -project(${PACKAGE}) +project(dbus) + +set (DBUS_MAJOR_VERSION "1") +set (DBUS_MINOR_VERSION "3") +set (DBUS_MICRO_VERSION "1") +# used by file version info +set (DBUS_PATCH_VERSION "1") +set (DBUS_VERSION ${DBUS_MAJOR_VERSION}.${DBUS_MINOR_VERSION}.${DBUS_MICRO_VERSION}) +endif (DBUS_PATCH_VERSION) + +set (DBUS_VERSION_STRING "${DBUS_VERSION}") # we need to be up to date CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR) @@ -43,7 +34,7 @@ if (WIN32) find_package(KDEWIN_Packager) find_package(LibIconv) include(Win32Macros) - addExplorerWrapper(${PACKAGE}) + addExplorerWrapper(${CMAKE_PROJECT_NAME}) endif (WIN32) find_package(LibXml2) find_package(LibExpat) @@ -129,7 +120,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") # change configuration in Visual Studio to 'Pocket PC 2003 (ARMV4)' # if(wince) - project(${PACKAGE}-wince) + project(${CMAKE_PROJECT_NAME}-wince) # don't forget parameters set(wince 1 CACHE TYPE STRING FORCE) set(wcelibcex ${wcelibcex} CACHE TYPE STRING FORCE) @@ -549,8 +540,8 @@ MESSAGE(" ") GET_FILENAME_COMPONENT(C_COMPILER ${CMAKE_C_COMPILER} NAME) GET_FILENAME_COMPONENT(CXX_COMPILER ${CMAKE_CXX_COMPILER} NAME) -message(" D-BUS ${VERSION} ") -message(" ========== ") +message(" D-BUS ${DBUS_VERSION} ") +message(" =========== ") message(" ") message(" prefix: ${prefix} ") message(" exec_prefix: ${exec_prefix} ") @@ -631,5 +622,5 @@ MESSAGE(" ") INCLUDE(modules/CPackInstallConfig.cmake) if (KDEWIN_PACKAGER_FOUND) - KDEWIN_PACKAGER(${PACKAGE} ${VERSION} "ipc library" "") + KDEWIN_PACKAGER(${CMAKE_PROJECT_NAME} ${DBUS_VERSION} "ipc library" "") endif (KDEWIN_PACKAGER_FOUND) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 1aee90f8a..db3837121 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -18,12 +18,11 @@ #cmakedefine DBUS_DAEMONDIR "@DBUS_DAEMONDIR@" #cmakedefine PACKAGE "@PACKAGE@" /* Version number of package */ -#cmakedefine VERSION "@VERSION@" -#cmakedefine DBUS_MAJOR_VERSION ${VERSION_MAJOR} -#cmakedefine DBUS_MINOR_VERSION ${VERSION_MINOR} -#cmakedefine DBUS_MICRO_VERSION ${VERSION_RELEASE} -#cmakedefine DBUS_VERSION ((@VERSION_MAJOR@ << 16) | (@VERSION_MINOR@ << 8) | (@VERSION_RELEASE@)) -#cmakedefine DBUS_VERSION_STRING "@VERSION@" +#cmakedefine DBUS_MAJOR_VERSION @DBUS_MAJOR_VERSION@ +#cmakedefine DBUS_MINOR_VERSION @DBUS_MINOR_VERSION@ +#cmakedefine DBUS_MICRO_VERSION @DBUS_MICRO_VERSION@ +#cmakedefine DBUS_VERSION ((@DBUS_MAJOR_VERSION@ << 16) | (@DBUS_MINOR_VERSION@ << 8) | (@DBUS_MICRO_VERSION@)) +#cmakedefine DBUS_VERSION_STRING "@DBUS_VERSION_STRING@" // test binaries /* Full path to test file test/test-exit in builddir */ diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index bb55989df..d840493de 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -228,6 +228,18 @@ set(libdbus_HEADERS # for debugging ${DBUS_UTIL_HEADERS} ) +if (MSVC) + set (BUILD_FILEVERSION ${DBUS_MAJOR_VERSION},${DBUS_MINOR_VERSION},${DBUS_MICRO_VERSION},${DBUS_PATCH_VERSION}) + + # no idea how to create the current date as string + message(STATUS "FIXME create the current date as string in dbus/CMakeLists.txt") + set (BUILD_TIMESTAMP 20091205) + + configure_file(${DBUS_DIR}/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/afxres.h "") + list(APPEND libdbus_SOURCES versioninfo.rc) + set_source_files_properties(versioninfo.rc COMPILE_FLAGS "-D__LINE__=1") +endif (MSVC) if(MSVC AND splitlib) set(DBUS_LIB_TYPE STATIC) diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c index 1b4792de7..0c1248307 100644 --- a/dbus/dbus-auth.c +++ b/dbus/dbus-auth.c @@ -1204,7 +1204,7 @@ handle_server_data_anonymous_mech (DBusAuth *auth, { DBusString plaintext; DBusString encoded; - _dbus_string_init_const (&plaintext, "D-Bus " VERSION); + _dbus_string_init_const (&plaintext, "D-Bus " DBUS_VERSION_STRING); _dbus_string_init (&encoded); _dbus_string_hex_encode (&plaintext, 0, &encoded, @@ -1262,7 +1262,7 @@ handle_client_initial_response_anonymous_mech (DBusAuth *auth, return FALSE; if (!_dbus_string_append (&plaintext, - "libdbus " VERSION)) + "libdbus " DBUS_VERSION_STRING)) goto failed; if (!_dbus_string_hex_encode (&plaintext, 0,