speed-dreams-code/cmake/FindENET.cmake
pouillot 407668c306 Promoted sdl-port branch to the new trunk, towards 2.0
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2276 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: cbff36e6bd206b0180816184b31d3a609616f669
Former-commit-id: cc1d132029d92e672f8520d2555f8dcdc5bbb92e
2010-02-28 09:04:35 +00:00

69 lines
No EOL
2.5 KiB
CMake
Executable file

# - Find ENET library
# Find the native ENET includes and library
# This module defines
# ENET_INCLUDE_DIR, where to find enet/enet.h
# ENET_LIBRARY libraries to link against to use ENET
# ENET_FOUND If false, do not try to use ENET
# $ENETDIR is an environment variable that would correspond
# to the prefix used to configure ENET.
#
# Created by Jean-Philippe Meuret, based on the FindOpenAL.cmake module
# modified by Bryan Donlan, from original version by Eric Wang.
FIND_PATH(ENET_INCLUDE_DIR enet/enet.h
HINTS ENV $ENETDIR
PATH_SUFFIXES
Headers include
PATHS
~/Library/Frameworks/GLFW.framework
/Library/Frameworks/GLFW.framework
/System/Library/Frameworks/GLFW.framework # Tiger
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt)
# I'm not sure if I should do a special casing for Apple. It is
# unlikely that other Unix systems will find the framework path.
# But if they do ([Next|Open|GNU]Step?),
# do they want the -framework option also?
IF(${ENET_INCLUDE_DIR} MATCHES ".framework")
STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ENET_FRAMEWORK_PATH_TMP ${ENET_INCLUDE_DIR})
IF("${ENET_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
OR "${ENET_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
)
# String is in default search path, don't need to use -F
SET (ENET_LIBRARY "-framework GLFW" CACHE STRING "GLFW framework for OSX")
ELSE("${ENET_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
OR "${ENET_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
)
# String is not /Library/Frameworks, need to use -F
SET(ENET_LIBRARY "-F${ENET_FRAMEWORK_PATH_TMP} -framework GLFW" CACHE STRING "GLFW framework for OSX")
ENDIF("${ENET_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
OR "${ENET_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
)
# Clear the temp variable so nobody can see it
SET(ENET_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
ELSE(${ENET_INCLUDE_DIR} MATCHES ".framework")
FIND_LIBRARY(ENET_LIBRARY
NAMES enet
HINTS ENV ENETDIR
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt)
ENDIF(${ENET_INCLUDE_DIR} MATCHES ".framework")
SET(ENET_FOUND "NO")
IF (ENET_LIBRARY)
SET(ENET_FOUND "YES")
#MESSAGE(STATUS "Found ENET: ${ENET_LIBRARY}")
ENDIF(ENET_LIBRARY)
#MARK_AS_ADVANCED(ENET_INCLUDE_DIR ENET_LIBRARY)