Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7151 for code/branches


Ignore:
Timestamp:
Jun 23, 2010, 6:32:14 PM (14 years ago)
Author:
rgrieder
Message:

Updated ENet version finding and added a warning for versions ≥ 1.3, which are not protocol compatible with 1.1 and 1.2.

Location:
code/branches/presentation3/cmake/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/cmake/tools/DetermineVersion.cmake

    r7139 r7151  
    2222 #  Description:
    2323 #    Inspects a given file for the following expressions
    24  #    "NAME_MAJOR_VERSION #"
    25  #    "NAME_MINOR_VERSION #"
    26  #    "NAME_PATCH_VERSION #"
     24 #    "NAME_VERSION_MAJOR #"
     25 #    "NAME_VERSION_MINOR #"
     26 #    "NAME_VERSION_PATCH #"
    2727 #    and sets NAME_VERSION accordingly. NAME_PART_VERSION variables are also
    2828 #    set. If you wish to look for different parts (e.g. "first" "second", etc.)
  • code/branches/presentation3/cmake/tools/FindENet.cmake

    r7139 r7151  
    3434)
    3535
    36 # Try to determine the version. Note that enet only stores the major
    37 # version in the header file. So we check for existing functions.
    38 # Hence the this script only distinguishes between 1.0, 1.1 and 1.2
    39 FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
    40 IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
    41   IF(_enet_header MATCHES "enet_socket_set_option")
    42     SET(ENET_VERSION 1.2)
    43   ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
    44     SET(ENET_VERSION 1.1)
     36# Only works for 1.2.2 and higher, otherwise see below
     37DETERMINE_VERSION(ENET ${ENET_INCLUDE_DIR}/enet/enet.h)
     38IF(${ENET_VERSION} STREQUAL "0.0.0")
     39  # Try to determine the version. Note that enet only stores the major
     40  # version in the header file. So we check for existing functions.
     41  # Hence the this script only distinguishes between 1.0, 1.1 and 1.2
     42  FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
     43  IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
     44    IF(_enet_header MATCHES "enet_socket_set_option")
     45      SET(ENET_VERSION 1.2)
     46    ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
     47      SET(ENET_VERSION 1.1)
     48    ELSE()
     49      SET(ENET_VERSION 1.0)
     50    ENDIF()
    4551  ELSE()
    46     SET(ENET_VERSION 1.0)
     52    SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
    4753  ENDIF()
    48 ELSE()
    49   SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
    5054ENDIF()
    5155
     
    5660  ENET_INCLUDE_DIR
    5761)
     62
     63COMPARE_VERSION_STRINGS(${ENET_VERSION} 1.2 _comparison TRUE)
     64IF(${_comparison} EQUAL 1)
     65  MESSAGE(STATUS "Warning: Using ENet version 1.3, which is not protocol compatible with 1.1 and 1.2.")
     66ENDIF()
    5867
    5968# Collect optimized and debug libraries
Note: See TracChangeset for help on using the changeset viewer.