Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2616 was 2616, checked in by rgrieder, 15 years ago
  • Split FindOggVorbis.cmake in two. Having them in one file doesn't make sense, we can group it somewhere else.
  • Updated all find scripts
  • Removed all standard paths (like /usr /usr/local, etc.) because they're already searched by CMake anyway
  • Several workarounds for certain libraries when using the find script in the CMake module path.
  • Property svn:eol-style set to native
File size: 3.0 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
26FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
27  PATHS
28  $ENV{ALUTDIR}
29  ~/Library/Frameworks/OpenAL.framework
30  /Library/Frameworks/OpenAL.framework
31  /System/Library/Frameworks/OpenAL.framework # Tiger
32  PATH_SUFFIXES include include/OpenAL include/AL Headers
33)
34
35# I'm not sure if I should do a special casing for Apple. It is
36# unlikely that other Unix systems will find the framework path.
37# But if they do ([Next|Open|GNU]Step?),
38# do they want the -framework option also?
39IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
40
41  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
42  IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
43      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
44      )
45    # String is in default search path, don't need to use -F
46    SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
47  ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
48      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
49      )
50    # String is not /Library/Frameworks, need to use -F
51    SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
52  ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
53    OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
54    )
55  # Clear the temp variable so nobody can see it
56  SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
57
58ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework")
59  FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
60    NAMES alut
61    PATHS $ENV{ALUTDIR}
62    PATH_SUFFIXES lib libs
63  )
64  FIND_LIBRARY(ALUT_LIBRARY_DEBUG
65    NAMES alutd alut_d
66    PATHS $ENV{ALUTDIR}
67    PATH_SUFFIXES lib libs
68  )
69ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
70
71# Handle the REQUIRED argument and set ALUT_FOUND
72FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
73    ALUT_INCLUDE_DIR
74    ALUT_LIBRARY_OPTIMIZED
75)
76
77# Collect optimized and debug libraries
78HANDLE_LIBRARY_TYPES(ALUT)
79
80MARK_AS_ADVANCED(
81    ALUT_INCLUDE_DIR
82    ALUT_LIBRARY_OPTIMIZED
83    ALUT_LIBRARY_DEBUG
84)
Note: See TracBrowser for help on using the repository browser.