Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 5, 2009, 10:15:05 PM (15 years ago)
Author:
rgrieder
Message:

Also synchronised sandbox_light with current trunk.

Location:
sandbox_light
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox_light

  • sandbox_light/cmake/TargetUtilities.cmake

    r5789 r6040  
    6767ENDIF()
    6868
    69 FUNCTION(ORXONOX_ADD_LIBRARY _target_name)
     69MACRO(ORXONOX_ADD_LIBRARY _target_name)
    7070  TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN})
    71 ENDFUNCTION(ORXONOX_ADD_LIBRARY)
    72 
    73 FUNCTION(ORXONOX_ADD_EXECUTABLE _target_name)
     71ENDMACRO(ORXONOX_ADD_LIBRARY)
     72
     73MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
    7474  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
    75 ENDFUNCTION(ORXONOX_ADD_EXECUTABLE)
    76 
    77 
    78 FUNCTION(TU_ADD_TARGET _target_name _target_type _additional_switches)
     75ENDMACRO(ORXONOX_ADD_EXECUTABLE)
     76
     77
     78MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches)
    7979  CAPITALISE_NAME(${_target_name} _target_name_capitalised)
    8080
     
    8888
    8989
    90   # GET_HEADER_FILES
     90  # Workaround: Source file properties get lost when leaving a subdirectory
     91  # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY
     92  FOREACH(_file ${_arg_SOURCE_FILES})
     93    IF(_file STREQUAL "H")
     94      SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE)
     95    ELSE()
     96      SET(_last_file ${_file})
     97      LIST(APPEND _${_target_name}_source_files ${_file})
     98    ENDIF()
     99  ENDFOREACH(_file)
     100
     101  # Assemble all header files of the library
    91102  IF(_arg_FIND_HEADER_FILES)
    92     GET_ALL_HEADER_FILES(_${target_name}_header_files)
     103    GET_ALL_HEADER_FILES(_${_target_name}_header_files)
    93104  ENDIF()
    94105
    95106  # Remove potential duplicates
    96   SET(_${_target_name}_files ${_${target_name}_header_files} ${_arg_SOURCE_FILES})
     107  SET(_${_target_name}_files ${_${_target_name}_header_files} ${_${_target_name}_source_files})
    97108  LIST(REMOVE_DUPLICATES _${_target_name}_files)
    98109
     
    141152  ENDIF()
    142153
     154  # No warnings needed from third party libraries
     155  IF(_arg_ORXONOX_EXTERNAL)
     156    REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
     157    ADD_COMPILER_FLAGS("-w")
     158  ENDIF()
     159
    143160  # Set default linking if required
    144161  IF(NOT _arg_SHARED AND NOT _arg_STATIC)
     
    156173    SET(_arg_STATIC)
    157174  ENDIF()
     175
     176  # Don't compile header files
     177  FOREACH(_file ${_${_target_name}_files})
     178    IF(NOT _file MATCHES "\\.(c|cc|cpp)")
     179      SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
     180    ENDIF()
     181  ENDFOREACH(_file)
     182
     183
    158184
    159185  # Add the library/executable
     
    164190    ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
    165191                   ${_${_target_name}_files})
     192  ENDIF()
     193
     194
     195
     196  # Change library prefix to "lib"
     197  IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
     198    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
     199      PREFIX "lib"
     200    )
     201  ENDIF()
     202
     203  # MSVC hack to exclude external library sources from the intellisense database
     204  # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
     205  # would not work because of the slash)
     206  IF(_arg_ORXONOX_EXTERNAL AND MSVC)
     207    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "-Zm1000")
    166208  ENDIF()
    167209
     
    214256  ENDIF()
    215257
    216 ENDFUNCTION(TU_ADD_TARGET)
     258ENDMACRO(TU_ADD_TARGET)
    217259
    218260
Note: See TracChangeset for help on using the changeset viewer.