Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem/cmake/FindALUT.cmake @ 2054

Last change on this file since 2054 was 2054, checked in by adrfried, 16 years ago

FindALUT and FindENet cleaned up

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1# - Locate FreeAlut
2# This module defines
3#  ALUT_LIBRARY
4#  ALUT_FOUND, if false, do not try to link to Alut
5#  ALUT_INCLUDE_DIR, where to find the headers
6#
7# $ALUTDIR is an environment variable that would
8# correspond to the ./configure --prefix=$ALUTDIR
9# used in building Alut.
10#
11# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
12# On OSX, this will prefer the Framework version (if found) over others.
13# People will have to manually change the cache values of
14# ALUT_LIBRARY to override this selection.
15# Tiger will include OpenAL as part of the System.
16# But for now, we have to look around.
17# Other (Unix) systems should be able to utilize the non-framework paths.
18#
19# Several changes and additions by Fabian 'x3n' Landau
20# Some simplifications by Adrian Friedli
21#                 > www.orxonox.net <
22
23FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
24  PATHS
25  $ENV{ALUTDIR}
26  ~/Library/Frameworks/OpenAL.framework
27  /Library/Frameworks/OpenAL.framework
28  /System/Library/Frameworks/OpenAL.framework # Tiger
29  /usr/local
30  /usr
31  /sw # Fink
32  /opt/local # DarwinPorts
33  /opt/csw # Blastwave
34  /opt
35  PATH_SUFFIXES include include/OpenAL include/AL Headers
36  )
37
38# I'm not sure if I should do a special casing for Apple. It is
39# unlikely that other Unix systems will find the framework path.
40# But if they do ([Next|Open|GNU]Step?),
41# do they want the -framework option also?
42IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
43  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
44  IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
45      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
46      )
47    # String is in default search path, don't need to use -F
48    SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
49  ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
50      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
51      )
52    # String is not /Library/Frameworks, need to use -F
53    SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
54  ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
55    OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
56    )
57  # Clear the temp variable so nobody can see it
58  SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
59
60ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework")
61  FIND_LIBRARY(ALUT_LIBRARY
62    NAMES alut
63    PATHS
64    $ENV{ALUTDIR}
65    /usr/local
66    /usr
67    /sw
68    /opt/local
69    /opt/csw
70    /opt
71    PATH_SUFFIXES lib libs
72    )
73ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
74
75# handle the QUIETLY and REQUIRED arguments and set ALUT_FOUND to TRUE if
76# all listed variables are TRUE
77INCLUDE(FindPackageHandleStandardArgs)
78FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG ALUT_LIBRARY ALUT_INCLUDE_DIR)
79
80MARK_AS_ADVANCED(ALUT_LIBRARY ALUT_INCLUDE_DIR)
Note: See TracBrowser for help on using the repository browser.