Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5923


Ignore:
Timestamp:
Oct 9, 2009, 5:47:46 PM (15 years ago)
Author:
rgrieder
Message:

Allowing multiple major dependency versions. Currently this is 3.1 and 4.0. I'm going to upload them soon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/cmake/PackageConfig.cmake

    r5781 r5923  
    2626
    2727# Check package version info
    28 # MAJOR: Interface breaking change somewhere (library version changed, etc.)
    29 # MINOR: Bug fix or small conformant changes
    30 SET(DEPENDENCY_VERSION_REQUIRED 3)
     28# MAJOR: Breaking change
     29# MINOR: No breaking changes by the dependency package
     30#        For example any code running on 3.0 should still run on 3.1
     31#        But you can specify that the code only runs on 3.1 and higher
     32#        or 4.0 and higher (so both 3.1 and 4.0 will work).
     33SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0)
     34
    3135IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
    3236  SET(DEPENDENCY_VERSION 1.0)
     
    4448
    4549INCLUDE(CompareVersionStrings)
    46 COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${DEPENDENCY_VERSION_REQUIRED} _result TRUE)
    47 IF(NOT _result EQUAL 0)
     50SET(_version_match FALSE)
     51FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
     52  # Get major version
     53  STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
     54  COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
     55  IF(_result EQUAL 0)
     56    COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
     57    IF(NOT _result LESS 0)
     58      SET(_version_match TRUE)
     59    ENDIF()
     60  ENDIF()
     61ENDFOREACH(_version)
     62IF(NOT _version_match)
    4863  MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
    49           "Required version: ${DEPENDENCY_VERSION_REQUIRED}\n"
    50           "You can get a new version from www.orxonox.net")
     64          "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
     65          "You can get a new version from www.orxonox.net")
    5166ENDIF()
    5267
Note: See TracChangeset for help on using the changeset viewer.