Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/bin-config/CMakeLists.txt @ 2624

Last change on this file since 2624 was 2624, checked in by rgrieder, 15 years ago

Replaced most of the ELSE(…) and ENDIF(…) with ELSE() and ENDIF(). Kept the shorter and the spreaded ones for better clarity since that's what it originally was thought for. But I can really pollute the code when having long conditions and lots of IFs.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1SET(READ_ONLY_CONFIG_FILES
2  def_keybindings.ini
3  def_masterKeybindings.ini
4  disco.txt
5  irc.tcl
6  remote.tcl
7  telnet_server.tcl
8)
9
10SET(WRITABLE_CONFIG_FILES
11  orxonox.ini
12)
13
14IF(TARDIS)
15  # OGRE can't find fonts to display config screen on Tardis,
16  # so providing default config file here (bug).
17  LIST(APPEND WRITABLE_CONFIG_FILES ogre.cfg)
18ENDIF(TARDIS)
19
20# We need the same code for both READ_ONLY and WRITABLE config files
21MACRO(CONFIGURE_FILES _file_name _build_configs _read_only_arg)
22  SET(_read_only ${_read_only_arg})
23  FOREACH(_build_config ${_build_configs})
24    # Is there an extra file in bin/Debug or bin/Release?
25    IF(${_build_config} MATCHES "Rel")
26      SET(_build_config_short "Release")
27    ELSE()
28      SET(_build_config_short "Debug")
29    ENDIF()
30    IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name})
31      SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name})
32    ELSE()
33      SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file_name})
34    ENDIF()
35
36    # Copy to the folder named like the build config for Visual Studio
37    IF(CMAKE_CONFIGURATION_TYPES)
38      SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_build_config}/${_file_name})
39    ELSE()
40      SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_file_name})
41    ENDIF()
42    # Only copy if target file doesn't exist. This may result in problems but
43    # otherwise we might delete a user's config
44    IF(NOT EXISTS ${_out_file} OR _read_only)
45      CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY)
46    ENDIF()
47  ENDFOREACH(_build_config)
48ENDMACRO(CONFIGURE_FILES)
49
50# Copy config files to all Visual Studio output directories
51IF(CMAKE_CONFIGURATION_TYPES)
52  SET(BUILD_CONFIGS ${CMAKE_CONFIGURATION_TYPES})
53ELSE()
54  SET(CONFIG_OUT_PATHS_REL ".")
55  SET(BUILD_CONFIGS ${CMAKE_BUILD_TYPE})
56ENDIF()
57
58FOREACH(_file_name ${READ_ONLY_CONFIG_FILES})
59  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" TRUE)
60ENDFOREACH(_file_name)
61FOREACH(_file_name ${WRITABLE_CONFIG_FILES})
62  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" FALSE)
63ENDFOREACH(_file_name)
64
65################ Run Scripts ##################
66
67# Create a run script for both Windows and Linux in the source root path if
68# CMake is not used to create multi-configuration project files
69IF(NOT CMAKE_CONFIGURATION_TYPES)
70  IF(WIN32)
71    SET(RUN_SCRIPT run.bat)
72    # Note: Do not use FILE(TO_NATIVE_PATH) because it doesn't work for MinGW
73    STRING(REGEX REPLACE "^([A-Z]\\:)\\/.*$" "\\1" WINDOWS_DRIVE_CHANGE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
74    STRING(REPLACE "/" "\\" CMAKE_RUNTIME_OUTPUT_DIRECTORY_WINDOWS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
75    STRING(REPLACE "/" "\\" ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS ${ORXONOX_RUNTIME_LIBRARY_DIRECTORY})
76  ELSE(UNIX)
77    SET(RUN_SCRIPT run)
78  ENDIF(WIN32)
79  IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT})
80    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${RUN_SCRIPT} ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT} @ONLY)
81  ENDIF()
82ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
Note: See TracBrowser for help on using the repository browser.