diff options
-rw-r--r-- | CMakeCPack.cmake | 11 | ||||
-rw-r--r-- | CMakeLists.txt | 16 |
2 files changed, 24 insertions, 3 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index f676349..9e6d831 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -10,10 +10,15 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}") SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}") - SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}") +# if version date is set then use that as the patch + IF(CMake_VERSION_DATE) + SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_DATE}") + ELSE(CMake_VERSION_DATE) + SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}") + ENDIF(CMake_VERSION_DATE) SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") SET(CPACK_SOURCE_PACKAGE_FILE_NAME - "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") + "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") IF(CMake_VERSION_RC) SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-RC-${CMake_VERSION_RC}") @@ -53,7 +58,7 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") SET(CPACK_PACKAGE_NAME cmake) # setup the name of the package for cygwin cmake-2.4.3 SET(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") + "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") # the source has the same name as the binary SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) # Create a cygwin version number in case there are changes for cygwin diff --git a/CMakeLists.txt b/CMakeLists.txt index 89bbc54..a5030e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,6 +345,22 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 5) SET(CMake_VERSION_PATCH 0) + +# CVS versions are odd, if this is an odd minor version +# then set the CMake_VERSION_DATE variable +MATH(EXPR OUT "${CMake_VERSION_MINOR} & 1") +IF(OUT EQUAL 1) + # extract the version Date from the cmVersion.cxx file + FILE(READ "${CMake_SOURCE_DIR}/Source/cmVersion.cxx" + CMAKE_VERSION_FILE_CONTENT) + STRING(REGEX MATCH "\\$Date: ([^ ]*) " + CMake_VERSION_DATE "${CMAKE_VERSION_FILE_CONTENT}") + STRING(REGEX REPLACE "\\$Date: ([^ ]*) " "\\1" + CMake_VERSION_DATE "${CMake_VERSION_DATE}") + STRING(REPLACE "/" "" CMake_VERSION_DATE + "${CMake_VERSION_DATE}") +ENDIF(OUT EQUAL 1) + SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}") |