Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: sandbox_qt/cmake/LibraryConfig.cmake @ 7424

Last change on this file since 7424 was 7421, checked in by rgrieder, 14 years ago

Basic stuff up and running for the Qt sandbox.
No GUI support yet.

  • Property svn:eol-style set to native
File size: 3.8 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")
[7421]42OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
[2618]43
44# Scripts for specific library and CMake config
45INCLUDE(LibraryConfigTardis)
[1505]46
[2673]47IF(DEPENDENCY_PACKAGE_ENABLE)
48  GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
[7225]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()
[2673]57  FIND_PATH(DEPENDENCY_PACKAGE_DIR
[7225]58    NAMES version.txt
[2651]59    PATHS
60      ${CMAKE_SOURCE_DIR}/dependencies
[2673]61      ${_dep_dir_1}
62      ${_dep_dir_2}
[7225]63    PATH_SUFFIXES ${_compiler_prefix} ${_compiler_prefix}/dependencies
[2711]64    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
[2651]65  )
[2673]66  IF(NOT DEPENDENCY_PACKAGE_DIR)
[2631]67    MESSAGE(STATUS "Warning: Could not find dependency directory."
68                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
[2651]69  ELSE()
[2674]70    INCLUDE(PackageConfigMinGW)
71    INCLUDE(PackageConfigMSVC)
[3196]72    INCLUDE(PackageConfig) # For both msvc and mingw
73  ENDIF()
[2673]74ENDIF(DEPENDENCY_PACKAGE_ENABLE)
[2631]75
[5781]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
[2616]87############### Library finding #################
88# Performs the search and sets the variables    #
[2579]89
[7421]90FIND_PACKAGE(QT4 COMPONENTS QtCore QtGui REQUIRED)
[5781]91
92
[2618]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)
[7421]99    #OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
[2925]100
101  IF(DEPENDENCY_PACKAGE_ENABLE)
[7421]102    #MARK_AS_ADVANCED(
103      #LINK_ZLIB_DYNAMIC
104    #)
[2925]105  ENDIF()
[2618]106ENDIF(WIN32)
Note: See TracBrowser for help on using the repository browser.