[cmake-commits] king committed CMakeLists.txt 1.127 1.128 DateStamp.h.in NONE 1.1 kwsysDateStamp.cmake NONE 1.1 kwsysDateStamp.py NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Nov 12 17:34:16 EST 2007


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv28350

Modified Files:
	CMakeLists.txt 
Added Files:
	DateStamp.h.in kwsysDateStamp.cmake kwsysDateStamp.py 
Log Message:
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.


--- NEW FILE: DateStamp.h.in ---
/*=========================================================================

  Program:   KWSys - Kitware System Library
  Module:    $RCSfile: DateStamp.h.in,v $

  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 at _DateStamp_h
#define @KWSYS_NAMESPACE at _DateStamp_h

/**
 * Version date year component.  The format is CCYY.
 */
#define @KWSYS_NAMESPACE at _VERSION_DATE_YEAR   @KWSYS_VERSION_DATE_YEAR@

/**
 * Version date month component.  The format is MM.
 */
#define @KWSYS_NAMESPACE at _VERSION_DATE_MONTH  @KWSYS_VERSION_DATE_MONTH@

/**
 * Version date day component.  The format is DD.
 */
#define @KWSYS_NAMESPACE at _VERSION_DATE_DAY    @KWSYS_VERSION_DATE_DAY@

/**
 * Version date accessible from preprocessor.
 * This is an integer in the format CCYYMMDD.
 */
#define @KWSYS_NAMESPACE at _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 at _VERSION_DATE_STRING "@KWSYS_VERSION_DATE_YEAR at -@KWSYS_VERSION_DATE_MONTH at -@KWSYS_VERSION_DATE_DAY@"

#endif

--- NEW FILE: kwsysDateStamp.cmake ---
# 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)

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/CMakeLists.txt,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- CMakeLists.txt	19 Sep 2007 15:16:57 -0000	1.127
+++ CMakeLists.txt	12 Nov 2007 22:34:14 -0000	1.128
@@ -135,6 +135,7 @@
   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 @@
   )
 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)
 

--- NEW FILE: kwsysDateStamp.py ---
#!/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()



More information about the Cmake-commits mailing list