Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/cmake/FindENet.cmake @ 2635

Last change on this file since 2635 was 2628, checked in by rgrieder, 16 years ago

Small fixes:

  • CheckOGREPlugins wasn't handling debug libraries correctly
  • OpenAL was missig the "Found OpenAL" message
  • changed all find scripts to show the library in the output instead of the include directory
  • Run script gets overridden by force
  • Also copy run script to the bin folder
  • Property svn:eol-style set to native
File size: 2.0 KB
RevLine 
[1505]1# - Try to find enet
2# Once done this will define
3#
4#  ENET_FOUND - system has enet
[2509]5#  ENet_INCLUDE_DIR - the enet include directory
[2626]6#  ENet_LIBRARY - the library needed to link against enet
[1505]7#
[2509]8# $ENETDIR is an environment variable used for finding enet.
9#
[1505]10#  Borrowed from The Mana World
11#  http://themanaworld.org/
12#
[1776]13# Several changes and additions by Fabian 'x3n' Landau
[2626]14# Lots of simplifications by Adrian Friedli and Reto Grieder
15# Version checking by Reto Grieder
[1776]16#                 > www.orxonox.net <
[1505]17
[2616]18INCLUDE(FindPackageHandleAdvancedArgs)
[2583]19INCLUDE(HandleLibraryTypes)
20
[2581]21FIND_PATH(ENET_INCLUDE_DIR enet/enet.h
[2616]22  PATHS $ENV{ENETDIR}
23  PATH_SUFFIXES include
[2579]24)
[2581]25FIND_LIBRARY(ENET_LIBRARY_OPTIMIZED
[2616]26  NAMES enet
27  PATHS $ENV{ENETDIR}
28  PATH_SUFFIXES lib
[2579]29)
[2581]30FIND_LIBRARY(ENET_LIBRARY_DEBUG
[2616]31  NAMES enetd enet_d
32  PATHS $ENV{ENETDIR}
33  PATH_SUFFIXES lib
[2579]34)
[1505]35
[2616]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
39FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
40IF(_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)
[2624]45  ELSE()
[2616]46    SET(ENET_VERSION 1.0)
[2624]47  ENDIF()
48ELSE()
[2616]49  SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
[2624]50ENDIF()
[2616]51
52# Handle the REQUIRED argument and set ENET_FOUND
53# Also check the the version requirements
54FIND_PACKAGE_HANDLE_ADVANCED_ARGS(ENet DEFAULT_MSG ${ENET_VERSION}
[2628]55  ENET_LIBRARY_OPTIMIZED
[2616]56  ENET_INCLUDE_DIR
[2579]57)
[1776]58
[2616]59# Collect optimized and debug libraries
60IF(NOT LINK_ENET_DYNAMIC AND WIN32)
[2582]61  # ENet is linked statically, hence we need to add some windows dependencies
[2614]62  HANDLE_LIBRARY_TYPES(ENET ws2_32 winmm)
[2624]63ELSE()
[2614]64  HANDLE_LIBRARY_TYPES(ENET)
[2624]65ENDIF()
[1505]66
[2579]67MARK_AS_ADVANCED(
[2616]68  ENET_INCLUDE_DIR
69  ENET_LIBRARY_OPTIMIZED
70  ENET_LIBRARY_DEBUG
[2579]71)
Note: See TracBrowser for help on using the repository browser.