[Orxonox-commit 2444] r7151 - code/branches/presentation3/cmake/tools
rgrieder at orxonox.net
rgrieder at orxonox.net
Wed Jun 23 18:32:15 CEST 2010
Author: rgrieder
Date: 2010-06-23 18:32:14 +0200 (Wed, 23 Jun 2010)
New Revision: 7151
Modified:
code/branches/presentation3/cmake/tools/DetermineVersion.cmake
code/branches/presentation3/cmake/tools/FindENet.cmake
Log:
Updated ENet version finding and added a warning for versions >= 1.3, which are not protocol compatible with 1.1 and 1.2.
Modified: code/branches/presentation3/cmake/tools/DetermineVersion.cmake
===================================================================
--- code/branches/presentation3/cmake/tools/DetermineVersion.cmake 2010-06-18 18:54:01 UTC (rev 7150)
+++ code/branches/presentation3/cmake/tools/DetermineVersion.cmake 2010-06-23 16:32:14 UTC (rev 7151)
@@ -21,9 +21,9 @@
# Reto Grieder
# Description:
# Inspects a given file for the following expressions
- # "NAME_MAJOR_VERSION #"
- # "NAME_MINOR_VERSION #"
- # "NAME_PATCH_VERSION #"
+ # "NAME_VERSION_MAJOR #"
+ # "NAME_VERSION_MINOR #"
+ # "NAME_VERSION_PATCH #"
# and sets NAME_VERSION accordingly. NAME_PART_VERSION variables are also
# set. If you wish to look for different parts (e.g. "first" "second", etc.)
# simply deliver them as additional arguments (have to be three though).
Modified: code/branches/presentation3/cmake/tools/FindENet.cmake
===================================================================
--- code/branches/presentation3/cmake/tools/FindENet.cmake 2010-06-18 18:54:01 UTC (rev 7150)
+++ code/branches/presentation3/cmake/tools/FindENet.cmake 2010-06-23 16:32:14 UTC (rev 7151)
@@ -33,20 +33,24 @@
PATH_SUFFIXES lib
)
-# Try to determine the version. Note that enet only stores the major
-# version in the header file. So we check for existing functions.
-# Hence the this script only distinguishes between 1.0, 1.1 and 1.2
-FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
-IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
- IF(_enet_header MATCHES "enet_socket_set_option")
- SET(ENET_VERSION 1.2)
- ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
- SET(ENET_VERSION 1.1)
+# Only works for 1.2.2 and higher, otherwise see below
+DETERMINE_VERSION(ENET ${ENET_INCLUDE_DIR}/enet/enet.h)
+IF(${ENET_VERSION} STREQUAL "0.0.0")
+ # Try to determine the version. Note that enet only stores the major
+ # version in the header file. So we check for existing functions.
+ # Hence the this script only distinguishes between 1.0, 1.1 and 1.2
+ FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
+ IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
+ IF(_enet_header MATCHES "enet_socket_set_option")
+ SET(ENET_VERSION 1.2)
+ ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
+ SET(ENET_VERSION 1.1)
+ ELSE()
+ SET(ENET_VERSION 1.0)
+ ENDIF()
ELSE()
- SET(ENET_VERSION 1.0)
+ SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
ENDIF()
-ELSE()
- SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
ENDIF()
# Handle the REQUIRED argument and set ENET_FOUND
@@ -56,6 +60,11 @@
ENET_INCLUDE_DIR
)
+COMPARE_VERSION_STRINGS(${ENET_VERSION} 1.2 _comparison TRUE)
+IF(${_comparison} EQUAL 1)
+ MESSAGE(STATUS "Warning: Using ENet version 1.3, which is not protocol compatible with 1.1 and 1.2.")
+ENDIF()
+
# Collect optimized and debug libraries
IF(NOT LINK_ENET_DYNAMIC AND WIN32)
# ENet is linked statically, hence we need to add some windows dependencies
More information about the Orxonox-commit
mailing list