Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/kicklib/cmake/tools/FindCEGUI.cmake @ 8012

Last change on this file since 8012 was 7960, checked in by rgrieder, 14 years ago

Applied C++ code changes to compile Orxonox with CEGUI 0.7 (does not run yet).

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1# Find CEGUI includes and library
2#
3# This module defines
4#  CEGUI_INCLUDE_DIR
5#  CEGUI_LIBRARY, the library to link against to use CEGUI.
6#  CEGUILUA_LIBRARY, the library to link against to use the CEGUI script module.
7#  CEGUI_TOLUA_LIBRARY, the library to link against to use Tolua++.
8#  CEGUI_FOUND, If false, do not try to use CEGUI
9#  CEGUI_VERSION, the version as string "x.y.z"
10#
11# Input:
12#  ENV{CEGUIDIR}, CEGUI path, optional
13#
14# Created by Matt Williams to find OGRE libraries
15# Copyright © 2007, Matt Williams
16#
17# Modified by Nicolas Schlumberger to find CEGUI libraries
18# and make it run on the Tardis-Infrastucture of the ETH Zurich
19# Copyright 2007, Nicolas Schlumberger
20#
21# Redistribution and use is allowed according to the terms of the BSD license.
22#
23# Several changes and additions by Fabian 'x3n' Landau
24# Lots of simplifications by Adrian Friedli and Reto Grieder
25# Version checking and CEGUILua finding by Reto Grieder
26#                 > www.orxonox.net <
27
28INCLUDE(CompareVersionStrings)
29INCLUDE(DetermineVersion)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
32
33# Find headers
34FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
35  PATHS $ENV{CEGUIDIR}
36  PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
37)
38
39# Inspect CEGUIVersion.h for the version number
40DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
41
42# Find CEGUI library
43FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
44  NAMES CEGUIBase CEGUI
45  PATHS $ENV{CEGUIDIR}
46  PATH_SUFFIXES lib bin
47)
48FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
49  NAMES
50    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
51    CEGUId CEGUI_d CEGUID CEGUI_D
52  PATHS $ENV{CEGUIDIR}
53  PATH_SUFFIXES lib bin
54)
55
56# Find CEGUILua libraries
57FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
58  NAMES CEGUILua CEGUILuaScriptModule
59  PATHS $ENV{CEGUIDIR}
60  PATH_SUFFIXES lib bin
61)
62FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
63  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
64  PATHS $ENV{CEGUIDIR}
65  PATH_SUFFIXES lib bin
66)
67
68# Find CEGUI Tolua++ libraries
69FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
70  NAMES CEGUItoluapp tolua++
71  PATHS $ENV{CEGUIDIR}
72  PATH_SUFFIXES lib bin
73)
74FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
75  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
76  PATHS $ENV{CEGUIDIR}
77  PATH_SUFFIXES lib bin
78)
79
80# Newer versions of CEGUI have the renderer for OGRE shipped with them
81COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_compare TRUE)
82IF(_version_compare GREATER -1)
83  # Find CEGUI OGRE Renderer libraries
84  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
85    NAMES CEGUIOgreRenderer
86    PATHS $ENV{CEGUIDIR}
87    PATH_SUFFIXES lib bin
88  )
89  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
90    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
91    PATHS $ENV{CEGUIDIR}
92    PATH_SUFFIXES lib bin
93  )
94  SET(CEGUI_OGRE_RENDERER_LIBRARY_NAME CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED)
95ELSE()
96  SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
97ENDIF()
98
99# Handle the REQUIRED argument and set CEGUI_FOUND
100# Also checks the version requirements if given
101FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
102  CEGUI_INCLUDE_DIR
103  CEGUI_LIBRARY_OPTIMIZED
104  CEGUILUA_LIBRARY_OPTIMIZED
105  CEGUI_TOLUA_LIBRARY_OPTIMIZED
106  ${CEGUI_OGRE_RENDERER_LIBRARY_NAME}
107)
108
109# Collect optimized and debug libraries
110HANDLE_LIBRARY_TYPES(CEGUI)
111HANDLE_LIBRARY_TYPES(CEGUILUA)
112HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
113IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
114  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
115ENDIF()
116
117MARK_AS_ADVANCED(
118  CEGUI_INCLUDE_DIR
119  CEGUI_LIBRARY_OPTIMIZED
120  CEGUI_LIBRARY_DEBUG
121  CEGUILUA_LIBRARY_OPTIMIZED
122  CEGUILUA_LIBRARY_DEBUG
123  CEGUI_TOLUA_LIBRARY_OPTIMIZED
124  CEGUI_TOLUA_LIBRARY_DEBUG
125  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
126  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
127)
Note: See TracBrowser for help on using the repository browser.