ENH: Adding DateStamp feature to KWSys. This provides a header file giving preprocessor access to a dated version. The 'datestamp' will be updated automatically every day by a script.
This commit is contained in:
parent
a546ba7ed4
commit
f8a5d485a0
|
@ -135,6 +135,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
|
|||
SET(KWSYS_USE_FundamentalType 1)
|
||||
SET(KWSYS_USE_Terminal 1)
|
||||
SET(KWSYS_USE_IOStream 1)
|
||||
SET(KWSYS_USE_DateStamp 1)
|
||||
ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
|
||||
|
||||
# Setup the large file support default.
|
||||
|
@ -628,14 +629,26 @@ SET(cppclasses
|
|||
)
|
||||
FOREACH(cpp ${cppclasses})
|
||||
IF(KWSYS_USE_${cpp})
|
||||
# Use the corresponding class.
|
||||
SET(KWSYS_CLASSES ${KWSYS_CLASSES} ${cpp})
|
||||
|
||||
# Load component-specific CMake code.
|
||||
IF(EXISTS ${PROJECT_SOURCE_DIR}/${cpp}.cmake)
|
||||
INCLUDE(${PROJECT_SOURCE_DIR}/kwsys${cpp}.cmake)
|
||||
ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/${cpp}.cmake)
|
||||
ENDIF(KWSYS_USE_${cpp})
|
||||
ENDFOREACH(cpp)
|
||||
|
||||
# Add selected C components.
|
||||
FOREACH(c Process Base64 FundamentalType MD5 Terminal System)
|
||||
FOREACH(c Process Base64 FundamentalType MD5 Terminal System DateStamp)
|
||||
IF(KWSYS_USE_${c})
|
||||
# Use the corresponding header file.
|
||||
SET(KWSYS_H_FILES ${KWSYS_H_FILES} ${c})
|
||||
|
||||
# Load component-specific CMake code.
|
||||
IF(EXISTS ${PROJECT_SOURCE_DIR}/${c}.cmake)
|
||||
INCLUDE(${PROJECT_SOURCE_DIR}/kwsys${c}.cmake)
|
||||
ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/${c}.cmake)
|
||||
ENDIF(KWSYS_USE_${c})
|
||||
ENDFOREACH(c)
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*=========================================================================
|
||||
|
||||
Program: KWSys - Kitware System Library
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
|
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notices for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#ifndef @KWSYS_NAMESPACE@_DateStamp_h
|
||||
#define @KWSYS_NAMESPACE@_DateStamp_h
|
||||
|
||||
/**
|
||||
* Version date year component. The format is CCYY.
|
||||
*/
|
||||
#define @KWSYS_NAMESPACE@_VERSION_DATE_YEAR @KWSYS_VERSION_DATE_YEAR@
|
||||
|
||||
/**
|
||||
* Version date month component. The format is MM.
|
||||
*/
|
||||
#define @KWSYS_NAMESPACE@_VERSION_DATE_MONTH @KWSYS_VERSION_DATE_MONTH@
|
||||
|
||||
/**
|
||||
* Version date day component. The format is DD.
|
||||
*/
|
||||
#define @KWSYS_NAMESPACE@_VERSION_DATE_DAY @KWSYS_VERSION_DATE_DAY@
|
||||
|
||||
/**
|
||||
* Version date accessible from preprocessor.
|
||||
* This is an integer in the format CCYYMMDD.
|
||||
*/
|
||||
#define @KWSYS_NAMESPACE@_VERSION_DATE_FULL @KWSYS_VERSION_DATE_YEAR@@KWSYS_VERSION_DATE_MONTH@@KWSYS_VERSION_DATE_DAY@
|
||||
|
||||
/**
|
||||
* Version date as a string literal.
|
||||
* The format is "CCYY-MM-DD".
|
||||
*/
|
||||
#define @KWSYS_NAMESPACE@_VERSION_DATE_STRING "@KWSYS_VERSION_DATE_YEAR@-@KWSYS_VERSION_DATE_MONTH@-@KWSYS_VERSION_DATE_DAY@"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
# Do not edit! Generated by kwsysDateStamp.py
|
||||
|
||||
# KWSys version date year component. Format is CCYY.
|
||||
SET(KWSYS_VERSION_DATE_YEAR 2007)
|
||||
|
||||
# KWSys version date month component. Format is MM.
|
||||
SET(KWSYS_VERSION_DATE_MONTH 11)
|
||||
|
||||
# KWSys version date day component. Format is DD.
|
||||
SET(KWSYS_VERSION_DATE_DAY 12)
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys,os
|
||||
import time
|
||||
|
||||
# Get the path to the directory containing this script.
|
||||
if __name__ == '__main__':
|
||||
selfdir = os.path.abspath(sys.path[0] or os.curdir)
|
||||
else:
|
||||
selfdir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
# Open the CMake code file.
|
||||
fname = os.path.join(selfdir, 'kwsysDateStamp.cmake')
|
||||
fout = open(fname, 'w');
|
||||
|
||||
# Get the current time.
|
||||
ct = time.localtime()
|
||||
|
||||
# Write the CMake code describing the date.
|
||||
fout.write("""# Do not edit! Generated by kwsysDateStamp.py
|
||||
|
||||
# KWSys version date year component. Format is CCYY.
|
||||
SET(KWSYS_VERSION_DATE_YEAR %04u)
|
||||
|
||||
# KWSys version date month component. Format is MM.
|
||||
SET(KWSYS_VERSION_DATE_MONTH %02u)
|
||||
|
||||
# KWSys version date day component. Format is DD.
|
||||
SET(KWSYS_VERSION_DATE_DAY %02u)
|
||||
""" % (ct.tm_year, ct.tm_mon, ct.tm_mday))
|
||||
|
||||
fout.close()
|
Loading…
Reference in New Issue