Use Subversion to automatically generate date and version information when building with CMake.

This commit is contained in:
stambaughw 2008-05-05 13:26:46 +00:00
parent 9021d9d01a
commit 994e4e5d7e
4 changed files with 45 additions and 3 deletions

View File

@ -25,6 +25,23 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
endif(CMAKE_COMPILER_IS_GNUCXX) endif(CMAKE_COMPILER_IS_GNUCXX)
# Include Subversion support to automagically create version header file.
find_package( Subversion )
if( Subversion_FOUND )
Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} Kicad )
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+).*" "\\1\\2\\3"
_kicad_svn_date ${Kicad_WC_LAST_CHANGED_DATE} )
set( KICAD_SVN_VERSION
"(${_kicad_svn_date} SVN-R${Kicad_WC_LAST_CHANGED_REV})" )
# Definition to conditionally use date and revision returned from the
# Subversion info command instead of hand coded date and revision in
# "include/build_verison.h". If subversion is not found or the hand
# coded make files are used then the date and version information must
# be manually edited.
add_definitions( -DHAVE_SVN_VERSION )
endif( Subversion_FOUND )
# Locations for install targets. # Locations for install targets.
set(KICAD_BIN bin CACHE PATH "Location of KiCad binaries.") set(KICAD_BIN bin CACHE PATH "Location of KiCad binaries.")
@ -78,10 +95,15 @@ include(${wxWidgets_USE_FILE})
# Include MinGW resource compiler. # Include MinGW resource compiler.
include(MinGWResourceCompiler) include(MinGWResourceCompiler)
# Generate config.h.
configure_file( ${CMAKE_SOURCE_DIR}/CMakeModules/config.h.cmake
${CMAKE_BINARY_DIR}/config.h )
# Include paths. # Include paths.
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/share) ${CMAKE_SOURCE_DIR}/share
${CMAKE_BINARY_DIR})
# CMake will look in these dirs for nested 'CMakeLists.txt' files. # CMake will look in these dirs for nested 'CMakeLists.txt' files.
# Binaries. # Binaries.

View File

@ -0,0 +1,8 @@
/* Do not modify this file, it was automatically generated by CMake */
#ifndef __KICAD_SVN_VERSION_H__
#define __KICAD_SVN_VERSION_H__
#cmakedefine KICAD_SVN_VERSION "@KICAD_SVN_VERSION@"
#endif /* __KICAD_SVN_VERSION_H__ */

View File

@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-May-2 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
+cmake
* Use Subversion to automatically generate build date and revision level
when building with CMake. Header file build_version.h will still need
manual updates when using the hand written make files.
2008-May-2 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-May-2 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================

View File

@ -5,7 +5,12 @@
COMMON_GLOBL wxString g_BuildVersion COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE #ifdef EDA_BASE
# ifdef HAVE_SVN_VERSION
# include "config.h"
(wxT(KICAD_SVN_VERSION))
# else
(wxT("(20080429-r1010)")) (wxT("(20080429-r1010)"))
# endif
#endif #endif
; ;