Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/testing/cmake/tools/TargetUtilities.cmake @ 9534

Last change on this file since 9534 was 9480, checked in by landauf, 12 years ago

added cmake flag ENABLE_GCOV to enable code coverage analysis with gcov

  • Property svn:eol-style set to native
File size: 18.2 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 #    Adds a library or an executable like ADD_LIBRARY/ADD_EXECUTABLE, but
24 #    accepts a lot more input information. Simply supply the keywords
25 #    described below in any order you wish.
26 #    The output is then stored in "_arg_ARGNAME" where ARGNAME is the the
27 #    name of the switch or list.
28 #
29 #    Switches: (when given --> TRUE, FALSE otherwise)
30 #      FIND_HEADER_FILES: Searches the current directory for all header files
31 #                         and adds them to the target.
32 #      EXCLUDE_FROM_ALL:  Inherited from ADD_LIBRARY/ADD_EXECUTABLE
33 #      ORXONOX_EXTERNAL:  Specify this for third party libraries
34 #      NO_DLL_INTERFACE:  Link statically with MSVC
35 #      NO_SOURCE_GROUPS:  Don't create msvc source groups
36 #      MODULE:            For dynamic module libraries (libraries only)
37 #      WIN32:             Inherited from ADD_EXECUTABLE (executables only)
38 #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
39 #                         specified with PCH_FILE
40 #      NO_INSTALL:        Do not install the target at all
41 #      NO_VERSION:        Prevents adding any version to a target
42 #      NO_BUILD_UNITS:    Disables automatic (full) build units
43 #
44 #    Lists:
45 #      LINK_LIBRARIES:    Redirects to TARGET_LINK_LIBRARIES
46 #      LINK_LIBS_LINUX:   Redirects to TARGET_LINK_LIBRARIES only on Linux
47 #      LINK_LIBS_WIN32:   Redirects to TARGET_LINK_LIBRARIES only on Windows
48 #      LINK_LIBS_APPLE:   Redirects to TARGET_LINK_LIBRARIES only on Apple
49 #      LINK_LIBS_UNIX:    Redirects to TARGET_LINK_LIBRARIES only on UNIX
50 #      VERSION:           Set version to the binary
51 #      SOURCE_FILES:      Source files for the target
52 #      DEFINE_SYMBOL:     Sets the DEFINE_SYMBOL target property
53 #      TOLUA_FILES:       Files with tolua interface
54 #      PCH_FILE:          Precompiled header file
55 #      PCH_EXCLUDE:       Source files to be excluded from PCH support
56 #      OUTPUT_NAME:       If you want a different name than the target name
57 #      EXCLUDE_FROM_BUILD_UNITS: Specifies files that are not put into
58 #                         automatic (full) build units. They can still
59 #                         explicitely be included in a BUILD_UNIT (partial)
60 #  Note:
61 #    This function also installs the target!
62 #  Prerequisistes:
63 #    ORXONOX_DEFAULT_LINK
64 #  Parameters:
65 #    _target_name, ARGN for the macro arguments
66 #
67
68INCLUDE(BuildUnits)
69INCLUDE(CMakeDependentOption)
70INCLUDE(CapitaliseName)
71INCLUDE(GenerateToluaBindings)
72INCLUDE(ParseMacroArguments)
73INCLUDE(SourceFileUtilities)
74IF(PCH_COMPILER_SUPPORT)
75  INCLUDE(PrecompiledHeaderFiles)
76ENDIF()
77
78MACRO(ORXONOX_ADD_LIBRARY _target_name)
79  TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
80ENDMACRO(ORXONOX_ADD_LIBRARY)
81
82MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
83  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
84 
85  # When using Visual Studio we want to use the output directory as working
86  # directory and we also want to specify where the external dlls
87  # (lua, ogre, etc.) are. The problem hereby is that these information cannot
88  # be specified in CMake because they are not stored in the actual project file.
89  # This workaround will create a configured *.vcproj.user file that holds the
90  # right values. When starting the solution for the first time,
91  # these get written to the *vcproj.yourPCname.yourname.user
92  IF(MSVC)
93    IF(MSVC10)
94      CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/src/template.vcxproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}.vcxproj.user")
95    ELSE()
96      STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?).*$" "\\1"
97             VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
98      CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/src/template.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}.vcproj.user")
99    ENDIF()
100  ENDIF(MSVC)
101ENDMACRO(ORXONOX_ADD_EXECUTABLE)
102
103
104MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches)
105  CAPITALISE_NAME(${_target_name} _target_name_capitalised)
106  STRING(TOUPPER "${_target_name}" _target_name_upper)
107
108  # Specify all possible options (either switch or with add. arguments)
109  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
110                  NO_DLL_INTERFACE   NO_SOURCE_GROUPS  PCH_NO_DEFAULT 
111                  NO_INSTALL         NO_VERSION        NO_BUILD_UNITS
112                  ${_additional_switches})
113  SET(_list_names LINK_LIBRARIES     VERSION           SOURCE_FILES
114                  DEFINE_SYMBOL      TOLUA_FILES       PCH_FILE
115                  PCH_EXCLUDE        OUTPUT_NAME       LINK_LIBS_LINUX
116                  LINK_LIBS_WIN32    LINK_LIBS_APPLE   LINK_LIBS_UNIX
117                  EXCLUDE_FROM_BUILD_UNITS)
118
119  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
120
121  # Process source files with support for build units
122  # Note: All file paths are relative to the root source directory, even the
123  #       name of the build unit.
124  SET(_${_target_name}_source_files)
125  SET(_get_build_unit_file FALSE)
126  SET(_add_to_build_unit FALSE)
127  FOREACH(_file ${_arg_SOURCE_FILES})
128    IF(_file STREQUAL "BUILD_UNIT")
129      # Next file is the name of the build unit
130      SET(_get_build_unit_file TRUE)
131    ELSEIF(_file STREQUAL "END_BUILD_UNIT")
132      IF(NOT _build_unit_file)
133        MESSAGE(FATAL_ERROR "No name provided for build unit")
134      ENDIF()
135      IF(ENABLE_BUILD_UNITS)
136        IF(NOT _build_unit_include_string)
137          MESSAGE(STATUS "Warning: Empty build unit!")
138        ENDIF()
139        IF(EXISTS ${_build_unit_file})
140          FILE(READ ${_build_unit_file} _include_string_file)
141        ENDIF()
142        IF(NOT _build_unit_include_string STREQUAL "${_include_string_file}")
143          FILE(WRITE ${_build_unit_file} "${_build_unit_include_string}")
144        ENDIF()
145        LIST(APPEND _${_target_name}_source_files ${_build_unit_file})
146        LIST(APPEND _${_target_name}_build_units ${_build_unit_file})
147        # Store the number of files included. May be used for full build units.
148        SET_SOURCE_FILES_PROPERTIES(${_build_unit_file}
149          PROPERTIES BUILD_UNIT_SIZE "${_build_unit_count}")
150      ENDIF()
151      SET(_add_to_build_unit FALSE)
152    ELSEIF(_get_build_unit_file)
153      # Note: ${_file} is relative to the binary directory
154      SET(_build_unit_file ${CMAKE_BINARY_DIR}/${_file})
155      SET(_get_build_unit_file FALSE)
156      SET(_add_to_build_unit TRUE)
157      SET(_build_unit_include_string)
158      SET(_build_unit_count "0")
159    ELSE()
160      # Default, add source file
161
162      # Prepare relative paths
163      IF(NOT _file MATCHES "^(.\\:|\\/)")
164        # Path can be relative to the current source directory if the file was
165        # not added with the source file macros. Otherwise there is a "./" at
166        # the beginning of each file and the filename is relative
167        # to the CMAKE_SOURCE_DIR
168        STRING(REGEX REPLACE "^\\.\\/(.+)$" "\\1" _temp ${_file})
169        IF(NOT ${_temp} STREQUAL ${_file})
170          SET(_file ${CMAKE_SOURCE_DIR}/${_temp})
171        ELSE()
172          SET(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
173        ENDIF()
174      ENDIF()
175
176      LIST(APPEND _${_target_name}_source_files ${_file})
177
178      # Handle build units
179      IF(_add_to_build_unit AND ENABLE_BUILD_UNITS)
180        IF(_file MATCHES "\\.(c|cc|cpp|cxx)$")
181          SET(_build_unit_include_string "${_build_unit_include_string}#include \"${_file}\"\n")
182          MATH(EXPR _build_unit_count "1 + ${_build_unit_count}")
183        ENDIF()
184        # Don't compile these files, even if they are source files
185        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
186      ENDIF()
187    ENDIF()
188  ENDFOREACH(_file)
189
190  # Assemble all header files of the library
191  IF(_arg_FIND_HEADER_FILES)
192    GET_ALL_HEADER_FILES(_${_target_name}_header_files)
193  ENDIF()
194
195  # Combine source and header files
196  SET(_${_target_name}_files
197    ${_${_target_name}_header_files}
198    ${_${_target_name}_source_files}
199  )
200  # Remove potential duplicates
201  LIST(REMOVE_DUPLICATES _${_target_name}_files)
202
203  # TOLUA_FILES
204  IF(_arg_TOLUA_FILES)
205    GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
206                            INPUTFILES ${_arg_TOLUA_FILES})
207    # Workaround for XCode: The folder where the bind files are written to has
208    # to be present beforehand.
209    IF(CMAKE_CONFIGURATION_TYPES)
210      FOREACH(_dir ${CMAKE_CONFIGURATION_TYPES})
211        FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_dir})
212      ENDFOREACH(_dir)
213    ENDIF()
214  ENDIF()
215
216  # Mark files to be excluded from build units
217  IF(_arg_EXCLUDE_FROM_BUILD_UNITS)
218    SET_SOURCE_FILES_PROPERTIES(${_arg_EXCLUDE_FROM_BUILD_UNITS}
219      PROPERTIES EXCLUDE_FROM_BUILD_UNITS TRUE)
220  ENDIF()
221
222  # Full build units
223  IF(ENABLE_BUILD_UNITS AND NOT _arg_NO_BUILD_UNITS)
224    # Use full build units even in partial mode for externals
225    IF(ENABLE_BUILD_UNITS MATCHES "full" OR _arg_ORXONOX_EXTERNAL)
226      GENERATE_BUILD_UNITS(${_target_name} _${_target_name}_files)
227    ENDIF()
228  ENDIF()
229
230  # First part (pre target) of precompiled header files
231  IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
232    # Provide convenient option to control PCH
233    IF(_arg_PCH_NO_DEFAULT)
234      SET(PCH_DEFAULT FALSE)
235    ELSE()
236      SET(PCH_DEFAULT TRUE)
237    ENDIF()
238    CMAKE_DEPENDENT_OPTION(PCH_ENABLE_${_target_name_upper}
239      "Enable using precompiled header files for library ${_target_name}." ${PCH_DEFAULT} PCH_ENABLE OFF)
240    # Almost never used individually, but produces a lot of options --> hide
241    MARK_AS_ADVANCED(PCH_ENABLE_${_target_name_upper})
242
243    IF(PCH_ENABLE_${_target_name_upper} AND NOT PCH_DISABLE_${_target_name})
244      PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE})
245    ENDIF()
246  ENDIF()
247
248  # Generate the source groups
249  IF(MSVC AND NOT _arg_NO_SOURCE_GROUPS)
250    GENERATE_SOURCE_GROUPS(${_${_target_name}_files})
251
252    IF(NOT _arg_ORXONOX_EXTERNAL)
253      # Move the ...Prereqs.h and the PCH files to the 'Config' section
254      IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_target_name_capitalised}Prereqs.h)
255        SOURCE_GROUP("Config" FILES ${_target_name_capitalised}Prereqs.h)
256      ENDIF()
257      IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_arg_PCH_FILE})
258        SOURCE_GROUP("Config" FILES ${CMAKE_CURRENT_SOURCE_DIR}/${_arg_PCH_FILE})
259      ENDIF()
260    ENDIF()
261  ENDIF()
262
263  # Set link mode (SHARED/STATIC)
264  IF(MSVC AND _arg_NO_DLL_INTERFACE)
265    # Certain libraries don't have dllexport/dllimport and can't be linked shared with MSVC
266    SET(_link_mode STATIC)
267  ELSEIF(_arg_ORXONOX_EXTERNAL)
268    # Externals can be linked shared or statically
269    SET(_link_mode ${ORXONOX_EXTERNAL_LINK_MODE})
270  ELSE()
271    # All our own libraries are linked dynamically because of static symbols
272    SET(_link_mode SHARED)
273  ENDIF()
274
275  # No warnings needed from third party libraries
276  IF(_arg_ORXONOX_EXTERNAL)
277    REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
278    ADD_COMPILER_FLAGS("-w" NOT MSVC)
279    ADD_COMPILER_FLAGS("-W0" MSVC)
280  ENDIF()
281
282  # Don't compile header files
283  FOREACH(_file ${_${_target_name}_files})
284    IF(NOT _file MATCHES "\\.(c|cc|cpp|cxx|mm)$")
285      SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
286    ENDIF()
287  ENDFOREACH(_file)
288
289
290
291  # Add the library/executable
292  IF("${_target_type}" STREQUAL "LIBRARY")
293    ADD_LIBRARY(${_target_name} ${_link_mode}
294                ${_arg_EXCLUDE_FROM_ALL} ${_${_target_name}_files})
295  ELSE()
296    ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
297                   ${_${_target_name}_files})
298  ENDIF()
299
300
301
302  # Change library prefix to "lib"
303  IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
304    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
305      PREFIX "lib"
306    )
307  ENDIF()
308
309  # MSVC hack to exclude external library sources from the intellisense database
310  # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
311  # would not work because of the slash)
312  IF(_arg_ORXONOX_EXTERNAL AND MSVC)
313    GET_TARGET_PROPERTY(_compile_flags ${_target_name} COMPILE_FLAGS)
314    IF(NOT _compile_flags)
315      SET(_compile_flags)
316    ENDIF()
317    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "${_compile_flags} -Zm1000")
318  ENDIF()
319
320  # Configure modules
321  IF (_arg_MODULE)
322    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
323      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
324      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
325    )
326    ADD_MODULE(${_target_name})
327    # Ensure that the main program depends on the module
328    SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE INTERNAL "")
329  ENDIF()
330
331  # Static library flags are not globally available
332  IF(ORXONOX_STATIC_LINKER_FLAGS)
333    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES STATIC_LIBRARY_FLAGS ${ORXONOX_STATIC_LINKER_FLAGS})
334  ENDIF()
335
336  # LINK_LIBRARIES
337  IF(_arg_LINK_LIBRARIES)
338    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
339  ENDIF()
340  IF(_arg_LINK_LIBS_LINUX AND LINUX)
341    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBS_LINUX})
342  ENDIF()
343  IF(_arg_LINK_LIBS_WIN32 AND WIN32)
344    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBS_WIN32})
345  ENDIF()
346  IF(_arg_LINK_LIBS_APPLE AND APPLE)
347    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBS_APPLE})
348  ENDIF()
349  IF(_arg_LINK_LIBS_UNIX AND UNIX)
350    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBS_UNIX})
351  ENDIF()
352
353  # Enable gcov (gcc code coverage analysis tool) if ENABLE_GCOV flag is defined
354  IF(ENABLE_GCOV)
355    TARGET_LINK_LIBRARIES(${_target_name} gcov)
356    ADD_COMPILER_FLAGS("-fprofile-arcs")
357    ADD_COMPILER_FLAGS("-ftest-coverage")
358  ENDIF()
359
360  # Visual Leak Detector specific stuff (avoids the include)
361  IF(VISUAL_LEAK_DETECTOR_ENABLE)
362    TARGET_LINK_LIBRARIES(${_target_name} debug ${VLD_LIBRARY})
363  ENDIF()
364
365  # RPATH settings for the installation
366  IF("${_target_type}" STREQUAL "LIBRARY")
367    IF(_arg_MODULE)
368      SET(_rpath "${MODULE_RPATH}")
369    ELSE()
370      SET(_rpath "${LIBRARY_RPATH}")
371    ENDIF()
372  ELSE()
373    SET(_rpath "${RUNTIME_RPATH}")
374  ENDIF()
375  SET_TARGET_PROPERTIES(${_target_name} PROPERTIES INSTALL_RPATH "${_rpath}")
376
377  # DEFINE_SYMBOL
378  IF(_arg_DEFINE_SYMBOL)
379    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_arg_DEFINE_SYMBOL})
380  ELSEIF(NOT _arg_ORXONOX_EXTERNAL)
381    # Automatically add the macro definitions for our own libraries
382    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL "${_target_name_upper}_SHARED_BUILD")
383  ENDIF()
384
385  # VERSION
386  IF(_arg_VERSION)
387    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${_arg_VERSION})
388  ELSEIF(NOT _arg_ORXONOX_EXTERNAL AND NOT _arg_NO_VERSION AND NOT ${_target_type} STREQUAL "EXECUTABLE")
389    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${ORXONOX_VERSION})
390  ENDIF()
391
392  # OUTPUT_NAME
393  IF(_arg_OUTPUT_NAME)
394    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES OUTPUT_NAME  ${_arg_OUTPUT_NAME})
395  ENDIF()
396
397  # Second part of precompiled header files
398  IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE AND NOT PCH_DISABLE_${_target_name})
399    PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE})
400  ENDIF()
401
402  # Install all targets except for static ones (executables also have SHARED in _link_mode)
403  IF(${_link_mode} STREQUAL "SHARED" AND NOT _arg_NO_INSTALL)
404    IF(_arg_MODULE)
405      INSTALL(TARGETS ${_target_name}
406        RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
407        LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
408      )
409    ELSE()
410      INSTALL(TARGETS ${_target_name}
411        RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
412        LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
413      )
414    ENDIF()
415    IF(INSTALL_PDB_FILES) # MSVC specific: install debug symbols files
416      FOREACH(_config RelForDevs RelWithDebInfo)
417        GET_TARGET_PROPERTY(_location ${_target_name} LOCATION_${_config})
418        # Get absolute location without dll/exe extension
419        STRING(REGEX REPLACE "^(.+)\\.(dll|exe)$" "\\1" _location_we ${_location})
420        IF(_arg_MODULE)
421          INSTALL(FILES ${_location_we}.pdb
422            DESTINATION ${MODULE_INSTALL_DIRECTORY}
423            CONFIGURATIONS ${_config}
424          )
425        ELSE()
426          INSTALL(FILES ${_location_we}.pdb
427            DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
428            CONFIGURATIONS ${_config}
429          )
430        ENDIF()
431      ENDFOREACH(_config)
432    ENDIF()
433  ENDIF()
434
435ENDMACRO(TU_ADD_TARGET)
436
437
438# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
439# This helps finding dynamically loadable modules at runtime
440
441FUNCTION(ADD_MODULE _target)
442  # We use the properties to get the name because the librarys name may differ from
443  # the target name (for example orxonox <-> liborxonox)
444
445  GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
446  GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
447
448  IF(CMAKE_CONFIGURATION_TYPES)
449    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
450      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
451
452      FILE(WRITE ${_module_filename})
453
454      INSTALL(
455        FILES ${_module_filename}
456        DESTINATION ${MODULE_INSTALL_DIRECTORY}
457        CONFIGURATIONS ${_config}
458      )
459    ENDFOREACH()
460  ELSE()
461    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
462
463    FILE(WRITE ${_module_filename})
464
465    INSTALL(
466      FILES ${_module_filename}
467      DESTINATION ${MODULE_INSTALL_DIRECTORY}
468    )
469  ENDIF()
470ENDFUNCTION(ADD_MODULE)
Note: See TracBrowser for help on using the repository browser.