Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/forks/pch_analyser/cmake/LibraryConfig.cmake @ 7944

Last change on this file since 7944 was 7425, checked in by rgrieder, 14 years ago

Fixed various problems revealed on tardis

  • Property svn:eol-style set to native
File size: 3.8 KB
Line 
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 #
27
28INCLUDE(CompareVersionStrings)
29INCLUDE(FindPackageHandleStandardArgs)
30
31# Prevent CMake from finding libraries in the installation folder on Windows.
32# There might already be an installation from another compiler
33IF(WIN32)
34  LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH  "${CMAKE_INSTALL_PREFIX}")
35  LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin")
36ENDIF()
37
38############## Platform Scripts #################
39
40# On Windows using a package causes way less problems
41SET(_option_msg "Set this to true to use precompiled dependecy archives")
42OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
43
44# Scripts for specific library and CMake config
45INCLUDE(LibraryConfigTardis)
46
47IF(DEPENDENCY_PACKAGE_ENABLE)
48  GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
49  GET_FILENAME_COMPONENT(_dep_dir_2 ${CMAKE_SOURCE_DIR}/../lib_dist ABSOLUTE)
50  IF(MINGW)
51    SET(_compiler_prefix mingw)
52  ELSEIF(MSVC80)
53    SET(_compiler_prefix msvc8)
54  ELSEIF(MSVC90)
55    SET(_compiler_prefix msvc9)
56  ENDIF()
57  FIND_PATH(DEPENDENCY_PACKAGE_DIR
58    NAMES version.txt
59    PATHS
60      ${CMAKE_SOURCE_DIR}/dependencies
61      ${_dep_dir_1}
62      ${_dep_dir_2}
63    PATH_SUFFIXES ${_compiler_prefix} ${_compiler_prefix}/dependencies
64    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
65  )
66  IF(NOT DEPENDENCY_PACKAGE_DIR)
67    MESSAGE(STATUS "Warning: Could not find dependency directory."
68                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
69  ELSE()
70    INCLUDE(PackageConfigMinGW)
71    INCLUDE(PackageConfigMSVC)
72    INCLUDE(PackageConfig) # For both msvc and mingw
73  ENDIF()
74ENDIF(DEPENDENCY_PACKAGE_ENABLE)
75
76# User script
77SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
78    "Specify a CMake script if you wish to write your own library path config.
79     See LibraryConfigTardis.cmake for an example.")
80IF(LIBRARY_CONFIG_USER_SCRIPT)
81  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
82    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
83  ENDIF()
84ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
85
86
87############### Library finding #################
88# Performs the search and sets the variables    #
89
90FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui REQUIRED)
91
92
93####### Static/Dynamic linking options ##########
94
95# On Windows dynamically linked libraries need some special treatment
96# You may want to edit these settings if you provide your own libraries
97# Note: Default option in the libraries vary, but our default option is dynamic
98IF(WIN32)
99    #OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
100
101  IF(DEPENDENCY_PACKAGE_ENABLE)
102    #MARK_AS_ADVANCED(
103      #LINK_ZLIB_DYNAMIC
104    #)
105  ENDIF()
106ENDIF(WIN32)
Note: See TracBrowser for help on using the repository browser.