Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/kicklib2/src/OrxonoxConfig.cmake @ 8328

Last change on this file since 8328 was 8318, checked in by rgrieder, 14 years ago

RPATH handling was broken in certain cases, esp. for "turn-key" (INSTALL_COPYABLE) installations.
Fixed by using the "$ORIGIN" token and distinguishing between executable, library and module when setting the RPATH.

  • Property svn:eol-style set to native
File size: 3.9 KB
RevLine 
[2710]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 #
[5664]19 #
20 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Configures the header files OrxonoxConfig.h and SpecialConfig.h
24 #    and sets some other options. All the build related options should be
25 #    found and set here if possible.
26 #
[1505]27
[5664]28#################### Options ####################
[2710]29
[5664]30# Global switch to disable Precompiled Header Files
[8284]31# Note: PCH temporarily disabled on Mac because of severe problems
32IF(PCH_COMPILER_SUPPORT AND NOT APPLE)
[5664]33  OPTION(PCH_ENABLE "Global PCH switch" TRUE)
34ENDIF()
[2710]35
[5929]36# Global switch to disable multiple file compilations
37OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE)
38
[5664]39# Use WinMain() or main()?
40IF(WIN32)
41  OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
42ENDIF()
43
44################ Platform Config ################
45
[2710]46# Check endianness
47INCLUDE(TestBigEndian)
48TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN)
49IF(NOT ORXONOX_BIG_ENDIAN)
50  SET(ORXONOX_LITTLE_ENDIAN TRUE)
51ENDIF()
52
53# Platforms
54SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
55SET(ORXONOX_PLATFORM_APPLE ${APPLE})
56SET(ORXONOX_PLATFORM_UNIX ${UNIX})
57IF(UNIX AND NOT APPLE)
58  SET(ORXONOX_PLATFORM_LINUX TRUE)
59ENDIF()
60
61# Check __forceinline
[2724]62IF(MSVC)
63  INCLUDE(CheckCXXSourceCompiles)
64  SET(_source "int main() { return 0; } __forceinline void test() { return; }")
65  CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
66ENDIF(MSVC)
[2710]67
[8284]68# Check some non standard system includes
[2710]69INCLUDE(CheckIncludeFileCXX)
70CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
[8284]71CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H)
[2710]72
[8284]73# Part of a woraround for OS X warnings. See OrxonoxConfig.h.in
74SET(ORX_HAVE_STDINT_H ${HAVE_STDINT_H})
75
[7818]76IF(MSVC)
77  # Check whether we can use Visual Leak Detector
78  FIND_FILE(VLD_DLL vld_x86.dll)
79  IF(VLD_DLL)
80    SET(HAVE_VLD TRUE)
81    OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off)
82    # Make sure the value is "on" or "off" for vld.ini
83    IF(VISUAL_LEAK_DETECTOR_ENABLE)
84      SET(VISUAL_LEAK_DETECTOR_ENABLE on)
85    ELSE()
86      SET(VISUAL_LEAK_DETECTOR_ENABLE off)
87    ENDIF()
88  ENDIF()
89  MARK_AS_ADVANCED(VLD_DLL)
90ENDIF()
91
[5664]92############## Configured Headers ###############
93
[2710]94SET(GENERATED_FILE_COMMENT
[3196]95   "DO NOT EDIT THIS FILE! <br>
[2710]96    It has been automatically generated by CMake from OrxonoxConfig.h.in")
97# Copy and configure OrxonoxConfig which gets included in every file
98CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h)
99# This file only gets included by very few classes to avoid a large recompilation
100CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h)
101
[3196]102SET(ORXONOX_CONFIG_FILES
103  ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in
104  ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
105)
[8284]106SET(ORXONOX_CONFIG_FILES_GENERATED
107  ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h
108  ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h
109)
[8285]110
111# Make special target including the configured header files for Visual Studio
112IF(MSVC)
113  ADD_CUSTOM_TARGET(config
114    SOURCES
115      ${ORXONOX_CONFIG_FILES}
116      ${ORXONOX_CONFIG_FILES_GENERATED}
117  )
118ENDIF()
Note: See TracBrowser for help on using the repository browser.