Changeset 6040 for sandbox_light/cmake/TargetUtilities.cmake
- Timestamp:
- Nov 5, 2009, 10:15:05 PM (15 years ago)
- Location:
- sandbox_light
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox_light
- Property svn:mergeinfo changed
-
sandbox_light/cmake/TargetUtilities.cmake
r5789 r6040 67 67 ENDIF() 68 68 69 FUNCTION(ORXONOX_ADD_LIBRARY _target_name)69 MACRO(ORXONOX_ADD_LIBRARY _target_name) 70 70 TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN}) 71 END FUNCTION(ORXONOX_ADD_LIBRARY)72 73 FUNCTION(ORXONOX_ADD_EXECUTABLE _target_name)71 ENDMACRO(ORXONOX_ADD_LIBRARY) 72 73 MACRO(ORXONOX_ADD_EXECUTABLE _target_name) 74 74 TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN}) 75 END FUNCTION(ORXONOX_ADD_EXECUTABLE)76 77 78 FUNCTION(TU_ADD_TARGET _target_name _target_type _additional_switches)75 ENDMACRO(ORXONOX_ADD_EXECUTABLE) 76 77 78 MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches) 79 79 CAPITALISE_NAME(${_target_name} _target_name_capitalised) 80 80 … … 88 88 89 89 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 91 102 IF(_arg_FIND_HEADER_FILES) 92 GET_ALL_HEADER_FILES(_${ target_name}_header_files)103 GET_ALL_HEADER_FILES(_${_target_name}_header_files) 93 104 ENDIF() 94 105 95 106 # 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}) 97 108 LIST(REMOVE_DUPLICATES _${_target_name}_files) 98 109 … … 141 152 ENDIF() 142 153 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 143 160 # Set default linking if required 144 161 IF(NOT _arg_SHARED AND NOT _arg_STATIC) … … 156 173 SET(_arg_STATIC) 157 174 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 158 184 159 185 # Add the library/executable … … 164 190 ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL} 165 191 ${_${_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") 166 208 ENDIF() 167 209 … … 214 256 ENDIF() 215 257 216 END FUNCTION(TU_ADD_TARGET)258 ENDMACRO(TU_ADD_TARGET) 217 259 218 260
Note: See TracChangeset
for help on using the changeset viewer.