Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/cmake/FindCEGUI.cmake @ 1776

Last change on this file since 1776 was 1776, checked in by landauf, 16 years ago

Many changes in almost all FindXYZ.cmake files. They now throw errors if something wasn't found.

  • Property svn:eol-style set to native
File size: 4.2 KB
Line 
1# Find CEGUI includes and library
2#
3# This module defines
4#  CEGUI_INCLUDE_DIR
5#  CEGUI_LIBRARIES, the libraries to link against to use CEGUI.
6#  CEGUI_LIB_DIR, the location of the libraries
7#  CEGUI_FOUND, If false, do not try to use CEGUI
8#
9# Created by Matt Williams to find OGRE libraries
10# Copyright © 2007, Matt Williams
11#
12# Modified by Nicolas Schlumberger to find CEGUI libraries
13# and make it run on the Tardis-Infrastucture of the ETH Zurich
14# Copyright 2007, Nicolas Schlumberger
15#
16# Redistribution and use is allowed according to the terms of the BSD license.
17#
18# Several changes and additions by Fabian 'x3n' Landau
19#                 > www.orxonox.net <
20
21IF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR AND CEGUI_LIB_DIR AND CEGUI_SCRIPT_LIBRARIES)
22    SET(CEGUI_FIND_QUIETLY TRUE) # Already in cache, be silent
23ENDIF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR AND CEGUI_LIB_DIR AND CEGUI_SCRIPT_LIBRARIES)
24
25IF (WIN32) #Windows
26    FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
27        ../libs/cegui-0.6.1/include
28    )
29
30    SET(CEGUI_LIBRARIES debug CEGUIBase_d optimized CEGUIBase)
31    FIND_LIBRARY(CEGUI_LIBDIR NAMES ${CEGUI_LIBRARIES} PATHS
32        ../libs/cegui-0.6.1/bin
33    )
34
35    # Strip the filename from the path
36    IF (CEGUI_LIBDIR)
37        GET_FILENAME_COMPONENT(CEGUI_LIBDIR ${CEGUI_LIBDIR} PATH)
38        SET (CEGUI_LIB_DIR ${CEGUI_LIBDIR} CACHE FILEPATH "")
39    ENDIF (CEGUI_LIBDIR)
40
41    IF (NOT CEGUI_SCRIPT_LIBDIR)
42        # Search Lua script module
43        SET(CEGUI_SCRIPT_LIBRARIES "CEGUILuaScriptModule")
44        FIND_LIBRARY(CEGUI_SCRIPT_LIBDIR NAMES ${CEGUI_SCRIPT_LIBRARIES} PATHS
45            ../libs/cegui-0.6.1/bin
46        )
47        IF (NOT CEGUI_SCRIPT_LIBDIR)
48            SET(CEGUI_SCRIPT_LIBRARIES "CEGUILua")
49            FIND_LIBRARY(CEGUI_SCRIPT_LIBDIR NAMES ${CEGUI_SCRIPT_LIBRARIES} PATHS
50                ../libs/cegui-0.6.1/bin
51            )
52            IF (NOT CEGUI_SCRIPT_LIBDIR)
53                SET(CEGUI_SCRIPT_LIBRARIES)
54            ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
55        ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
56    ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
57
58    # Strip the filename from the path
59    IF (CEGUI_SCRIPT_LIBDIR)
60        GET_FILENAME_COMPONENT(CEGUI_SCRIPT_LIBDIR ${CEGUI_SCRIPT_LIBDIR} PATH)
61        SET (CEGUI_SCRIPT_LIB_DIR ${CEGUI_SCRIPT_LIBDIR} CACHE FILEPATH "")
62    ENDIF (CEGUI_SCRIPT_LIBDIR)
63
64ELSE (WIN32) #Unix
65    FIND_PACKAGE(PkgConfig)
66    PKG_SEARCH_MODULE(CEGUI CEGUI /usr/pack/cegui-0.5.0-sd/i686-debian-linux3.1/lib/pkgconfig/CEGUI.pc) # tardis specific hack
67    SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIRS})
68    SET(CEGUI_LIB_DIR ${CEGUI_LIBDIR})
69    SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "")
70    SET(CEGUI_SCRIPT_LIBRARIES "CEGUILuaScriptModule")
71    SET(CEGUI_SCRIPT_LIB_DIR)
72ENDIF (WIN32)
73
74IF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES AND CEGUI_LIB_DIR AND CEGUI_SCRIPT_LIBRARIES)
75    SET(CEGUI_FOUND TRUE)
76
77    #Do some preparation
78    SEPARATE_ARGUMENTS(CEGUI_INCLUDE_DIR)
79    SEPARATE_ARGUMENTS(CEGUI_LIBRARIES)
80
81    SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIR} CACHE PATH "")
82    SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "")
83    SET(CEGUI_LIB_DIR ${CEGUI_LIB_DIR} CACHE PATH "")
84    SET(CEGUI_SCRIPT_LIBRARIES ${CEGUI_SCRIPT_LIBRARIES} CACHE PATH "")
85ENDIF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES AND CEGUI_LIB_DIR AND CEGUI_SCRIPT_LIBRARIES)
86
87IF (CEGUI_FOUND)
88    IF (NOT CEGUI_FIND_QUIETLY)
89        MESSAGE(STATUS "CEGUI was found.")
90        IF (VERBOSE_FIND)
91            MESSAGE (STATUS "  include path: ${CEGUI_INCLUDE_DIR}")
92            MESSAGE (STATUS "  library path: ${CEGUI_LIB_DIR}")
93            MESSAGE (STATUS "  libraries:    ${CEGUI_LIBRARIES}")
94            MESSAGE (STATUS "           :    ${CEGUI_SCRIPT_LIBRARIES}")
95        ENDIF (VERBOSE_FIND)
96    ENDIF (NOT CEGUI_FIND_QUIETLY)
97ELSE (CEGUI_FOUND)
98    IF (NOT CEGUI_INCLUDE_DIR)
99        MESSAGE(SEND_ERROR "CEGUI include path was not found.")
100    ENDIF (NOT CEGUI_INCLUDE_DIR)
101    IF (NOT CEGUI_LIB_DIR)
102        MESSAGE(SEND_ERROR "CEGUI library was not found.")
103    ENDIF (NOT CEGUI_LIB_DIR)
104    IF (NOT CEGUI_LIBRARIES)
105        MESSAGE(SEND_ERROR "CEGUI libraries not known.")
106    ENDIF (NOT CEGUI_LIBRARIES)
107    IF (NOT CEGUI_SCRIPT_LIBRARIES)
108        MESSAGE(SEND_ERROR "CEGUI Lua script module was not found.")
109    ENDIF (NOT CEGUI_SCRIPT_LIBRARIES)
110ENDIF (CEGUI_FOUND)
111
Note: See TracBrowser for help on using the repository browser.