Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2577


Ignore:
Timestamp:
Jan 7, 2009, 1:22:33 PM (16 years ago)
Author:
rgrieder
Message:

Improved DetermineVersion.cmake

Location:
code/branches/buildsystem2/cmake
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2/cmake/DetermineVersion.cmake

    r2573 r2577  
    1717#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
    1818
    19 MACRO(DetermineVersion _name _file _version_var)
     19MACRO(DetermineVersion _name _file)
    2020  FILE(READ ${_file} _file_content)
    2121  IF(_file_content)
    22     STRING(REGEX MATCH "${_name}_VERSION_MAJOR +([0-9]+)" _dummyvar ${_file_content})
    23     SET(_version "${CMAKE_MATCH_1}")
    24     STRING(REGEX MATCH "${_name}_VERSION_MINOR +([0-9]+)" _dummyvar ${_file_content})
    25     SET(_version "${_version}.${CMAKE_MATCH_1}")
    26     STRING(REGEX MATCH "${_name}_VERSION_PATCH +([0-9]+)" _dummyvar ${_file_content})
    27     SET(_version "${_version}.${CMAKE_MATCH_1}")
    28     SET(${_version_var} "${_version}")
     22    SET(_parts ${ARGN})
     23    LIST(LENGTH _parts _parts_length)
     24    IF(NOT ${_parts_length} EQUAL 3)
     25      SET(_parts MAJOR MINOR PATCH)
     26    ENDIF(NOT ${_parts_length} EQUAL 3)
     27
     28    FOREACH(_part ${_parts})
     29      STRING(REGEX MATCH "${_name}_VERSION_${_part} +([0-9]+)" _match ${_file_content})
     30      IF(_match)
     31        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1} CACHE STRING "")
     32      ELSE(_match)
     33        SET(${_name}_VERSION_${_part} "0" CACHE STRING "")
     34      ENDIF(_match)
     35      MARK_AS_ADVANCED(${_name}_VERSION_${_part})
     36      IF("${_parts}" MATCHES "^${_part}") # First?
     37        SET(${_name}_VERSION "${${_name}_VERSION_${_part}}" CACHE STRING "" FORCE)
     38      ELSE("${_parts}" MATCHES "^${_part}")
     39        SET(${_name}_VERSION "${${_name}_VERSION}.${${_name}_VERSION_${_part}}" CACHE STRING "" FORCE)
     40      ENDIF("${_parts}" MATCHES "^${_part}")
     41    ENDFOREACH(_part)
     42    MARK_AS_ADVANCED(${_name}_VERSION)
    2943  ENDIF(_file_content)
    3044ENDMACRO(DetermineVersion)
  • code/branches/buildsystem2/cmake/FindCEGUI.cmake

    r2576 r2577  
    6060# Look in CEGUIVersion.h for the version number
    6161INCLUDE(DetermineVersion)
    62 DetermineVersion(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h _CEGUI_VERSION_temp)
    63 SET(CEGUI_VERSION "${_CEGUI_VERSION_temp}" CACHE STRING "")
     62DetermineVersion(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
    6463# STRLESS can be dangerous since it only compares strings.
    65 # Howerver VERSION_LESS seems to be having serious issues.
     64# Unfortunately VERSION_LESS is only provided since CMake v2.6.2
    6665IF(${CEGUI_VERSION} STRLESS "0.5.0")
    6766   MESSAGE(FATAL_ERROR "Minimum CEGUI version required is 0.5.0")
Note: See TracChangeset for help on using the changeset viewer.