Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/forks/sandbox_light/cmake/LibraryConfig.cmake @ 9187

Last change on this file since 9187 was 7909, checked in by rgrieder, 14 years ago

Added missing std includes to ogremath and removed boost thread and date_time dependencies.

  • Property svn:eol-style set to native
File size: 4.4 KB
RevLine 
[2626]1 #
2 #             ORXONOX - the hottest 3D action shooter ever to exist
3 #                             > www.orxonox.net <
4 #
5 #        This program is free software; you can redistribute it and/or
6 #         modify it under the terms of the GNU General Public License
7 #        as published by the Free Software Foundation; either version 2
8 #            of the License, or (at your option) any later version.
9 #
10 #       This program is distributed in the hope that it will be useful,
11 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #                 GNU General Public License for more details.
14 #
15 #   You should have received a copy of the GNU General Public License along
16 #      with this program; if not, write to the Free Software Foundation,
17 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 #
19 #
20 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Configures the external libraries. Whenever possible, the find scripts
24 #    from the CMake module path are used, but that required some adjustments
25 #    for certain libraries (Boost, OpenAL, TCL)
26 #
[6417]27
[2618]28INCLUDE(CompareVersionStrings)
29INCLUDE(FindPackageHandleStandardArgs)
30
[2696]31# Prevent CMake from finding libraries in the installation folder on Windows.
[2645]32# There might already be an installation from another compiler
[5695]33IF(WIN32)
[2696]34  LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH  "${CMAKE_INSTALL_PREFIX}")
35  LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin")
36ENDIF()
[2645]37
[2631]38############## Platform Scripts #################
[2618]39
[2631]40# On Windows using a package causes way less problems
41SET(_option_msg "Set this to true to use precompiled dependecy archives")
42IF(WIN32)
[2673]43  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
[2631]44ELSE(WIN32)
[2673]45  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
[2631]46ENDIF(WIN32)
[2618]47
48# Scripts for specific library and CMake config
49INCLUDE(LibraryConfigTardis)
[5781]50INCLUDE(LibraryConfigApple)
[1505]51
[2673]52IF(DEPENDENCY_PACKAGE_ENABLE)
53  GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
[7225]54  GET_FILENAME_COMPONENT(_dep_dir_2 ${CMAKE_SOURCE_DIR}/../lib_dist ABSOLUTE)
55  IF(MINGW)
56    SET(_compiler_prefix mingw)
57  ELSEIF(MSVC80)
58    SET(_compiler_prefix msvc8)
59  ELSEIF(MSVC90)
60    SET(_compiler_prefix msvc9)
61  ENDIF()
[2673]62  FIND_PATH(DEPENDENCY_PACKAGE_DIR
[7225]63    NAMES version.txt
[2651]64    PATHS
65      ${CMAKE_SOURCE_DIR}/dependencies
[2673]66      ${_dep_dir_1}
67      ${_dep_dir_2}
[7225]68    PATH_SUFFIXES ${_compiler_prefix} ${_compiler_prefix}/dependencies
[2711]69    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
[2651]70  )
[2673]71  IF(NOT DEPENDENCY_PACKAGE_DIR)
[2631]72    MESSAGE(STATUS "Warning: Could not find dependency directory."
73                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
[2651]74  ELSE()
[2674]75    INCLUDE(PackageConfigMinGW)
76    INCLUDE(PackageConfigMSVC)
[3196]77    INCLUDE(PackageConfig) # For both msvc and mingw
78  ENDIF()
[2673]79ENDIF(DEPENDENCY_PACKAGE_ENABLE)
[2631]80
[5781]81# User script
82SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
83    "Specify a CMake script if you wish to write your own library path config.
84     See LibraryConfigTardis.cmake for an example.")
85IF(LIBRARY_CONFIG_USER_SCRIPT)
86  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
87    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
88  ENDIF()
89ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
90
91
[2616]92############### Library finding #################
93# Performs the search and sets the variables    #
[2579]94
[7908]95#FIND_PACKAGE(POCO          REQUIRED)
[5781]96IF(WIN32)
[7449]97  FIND_PACKAGE(DbgHelp)
[7224]98ENDIF()
[5781]99
[2616]100##### Boost #####
101# Expand the next statement if newer boost versions than 1.36.1 are released
[7237]102SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0 1.40 1.40.0
103                              1.41 1.41.0 1.42 1.42.0 1.43 1.43.0 1.44 1.44.0)
[6461]104IF( NOT TARDIS )
[7909]105  FIND_PACKAGE(Boost 1.35 REQUIRED filesystem system)
[6461]106ENDIF()
[2673]107# No auto linking, so this option is useless anyway
108MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
[2618]109
[3304]110
[2618]111####### Static/Dynamic linking options ##########
112
113# On Windows dynamically linked libraries need some special treatment
114# You may want to edit these settings if you provide your own libraries
115# Note: Default option in the libraries vary, but our default option is dynamic
116IF(WIN32)
117  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
[2925]118
119  IF(DEPENDENCY_PACKAGE_ENABLE)
[7908]120    MARK_AS_ADVANCED(LINK_BOOST_DYNAMIC)
[2925]121  ENDIF()
[2618]122ENDIF(WIN32)
Note: See TracBrowser for help on using the repository browser.