summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-11-12 22:34:14 (GMT)
committerBrad King <brad.king@kitware.com>2007-11-12 22:34:14 (GMT)
commitf8a5d485a064820b62f8a853d107cb23c114efb0 (patch)
treeee0497f84f348a151a503443a9eb86bd39c3f430 /Source/kwsys
parenta546ba7ed496312137202cdb356ebf739350cf5e (diff)
downloadCMake-f8a5d485a064820b62f8a853d107cb23c114efb0.zip
CMake-f8a5d485a064820b62f8a853d107cb23c114efb0.tar.gz
CMake-f8a5d485a064820b62f8a853d107cb23c114efb0.tar.bz2
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.
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/CMakeLists.txt15
-rw-r--r--Source/kwsys/DateStamp.h.in44
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake10
-rwxr-xr-xSource/kwsys/kwsysDateStamp.py32
4 files changed, 100 insertions, 1 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 13b884b..2786435 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -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)
diff --git a/Source/kwsys/DateStamp.h.in b/Source/kwsys/DateStamp.h.in
new file mode 100644
index 0000000..31550dc
--- /dev/null
+++ b/Source/kwsys/DateStamp.h.in
@@ -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
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
new file mode 100644
index 0000000..161413d
--- /dev/null
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -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)
diff --git a/Source/kwsys/kwsysDateStamp.py b/Source/kwsys/kwsysDateStamp.py
new file mode 100755
index 0000000..4370c8a
--- /dev/null
+++ b/Source/kwsys/kwsysDateStamp.py
@@ -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()