Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/cmake/FindALUT.cmake @ 2606

Last change on this file since 2606 was 2583, checked in by rgrieder, 16 years ago
  • Use $ENV{BOOST_ROOT} to find boost if possible
  • Set TOLUA_PARSER_WORKING_DIRECTORY now defaults to ${CMAKE_RUNTIME_OUTPUT_PATH}
  • Added bin/release, bin/debug, release and debug to the Ogre library prefix paths
  • Lots of small fixes and changes
  • Property svn:eol-style set to native
File size: 3.2 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
23INCLUDE(FindPackageHandleStandardArgs)
24INCLUDE(HandleLibraryTypes)
25
26SET(ALUT_PATHS
27  $ENV{ALUTDIR}
28  /usr/local
29  /usr
30  /sw        # Fink
31  /opt/local # DarwinPorts
32  /opt/csw   # Blastwave
33  /opt
34)
35
36FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
37  PATHS
38  ${ALUT_PATHS}
39  ~/Library/Frameworks/OpenAL.framework
40  /Library/Frameworks/OpenAL.framework
41  /System/Library/Frameworks/OpenAL.framework # Tiger
42  PATH_SUFFIXES include include/OpenAL include/AL Headers
43)
44
45# I'm not sure if I should do a special casing for Apple. It is
46# unlikely that other Unix systems will find the framework path.
47# But if they do ([Next|Open|GNU]Step?),
48# do they want the -framework option also?
49IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
50
51  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
52  IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
53      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
54      )
55    # String is in default search path, don't need to use -F
56    SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
57  ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
58      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
59      )
60    # String is not /Library/Frameworks, need to use -F
61    SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
62  ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
63    OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
64    )
65  # Clear the temp variable so nobody can see it
66  SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
67
68ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework")
69  FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
70    NAMES alut
71    PATHS ${ALUT_PATHS}
72    PATH_SUFFIXES lib libs
73  )
74  FIND_LIBRARY(ALUT_LIBRARY_DEBUG
75    NAMES alut${LIBRARY_DEBUG_POSTFIX}
76    PATHS ${ALUT_PATHS}
77    PATH_SUFFIXES lib libs
78  )
79ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
80
81# handle the QUIETLY and REQUIRED arguments and set ALUT_FOUND to TRUE if
82# all listed variables are TRUE
83FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
84    ALUT_LIBRARY_OPTIMIZED
85    ALUT_INCLUDE_DIR
86)
87
88# Set optimized and debug libraries
89HandleLibraryTypes(ALUT)
90
91MARK_AS_ADVANCED(
92    ALUT_LIBRARY
93    ALUT_LIBRARY_OPTIMIZED
94    ALUT_LIBRARY_DEBUG
95    ALUT_INCLUDE_DIR
96)
Note: See TracBrowser for help on using the repository browser.