Changeset 7421 for sandbox_qt/cmake/tools
- Timestamp:
- Sep 12, 2010, 12:47:30 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox_qt/cmake/tools/TargetUtilities.cmake
r7416 r7421 34 34 # NO_DLL_INTERFACE: Link statically with MSVC 35 35 # NO_SOURCE_GROUPS: Don't create msvc source groups 36 # MODULE: For dynamic module libraries (libraries only)37 36 # WIN32: Inherited from ADD_EXECUTABLE (executables only) 38 37 # PCH_NO_DEFAULT: Do not make precompiled header files default if … … 46 45 # SOURCE_FILES: Source files for the target 47 46 # DEFINE_SYMBOL: Sets the DEFINE_SYMBOL target property 48 # TOLUA_FILES: Files with tolua interface49 47 # PCH_FILE: Precompiled header file 50 48 # PCH_EXCLUDE: Source files to be excluded from PCH support 51 49 # OUTPUT_NAME: If you want a different name than the target name 50 # QT_MOC_FILES: List of files to be processed by Qt MOC 51 # QT_UIC_FILES: List of files to be processed by Qt UIC 52 52 # Note: 53 53 # This function also installs the target! … … 60 60 INCLUDE(CMakeDependentOption) 61 61 INCLUDE(CapitaliseName) 62 INCLUDE(GenerateToluaBindings)63 62 INCLUDE(ParseMacroArguments) 64 63 INCLUDE(SourceFileUtilities) … … 68 67 69 68 MACRO(ORXONOX_ADD_LIBRARY _target_name) 70 TU_ADD_TARGET(${_target_name} LIBRARY " MODULE" ${ARGN})69 TU_ADD_TARGET(${_target_name} LIBRARY "" ${ARGN}) 71 70 ENDMACRO(ORXONOX_ADD_LIBRARY) 72 71 … … 85 84 NO_INSTALL NO_VERSION ${_additional_switches}) 86 85 SET(_list_names LINK_LIBRARIES VERSION SOURCE_FILES 87 DEFINE_SYMBOL TOLUA_FILES PCH_FILE88 PCH_EXCLUDE OUTPUT_NAME)86 DEFINE_SYMBOL PCH_FILE PCH_EXCLUDE 87 OUTPUT_NAME QT_MOC_FILES QT_UIC_FILES) 89 88 90 89 PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN}) … … 107 106 ENDIF() 108 107 109 # Combine source and header files108 # Combine source, header and QT designer files 110 109 SET(_${_target_name}_files 111 110 ${_${_target_name}_header_files} 112 111 ${_${_target_name}_source_files} 112 ${_arg_QT_UIC_FILES} 113 113 ) 114 114 # Remove potential duplicates 115 115 LIST(REMOVE_DUPLICATES _${_target_name}_files) 116 116 117 # TOLUA_FILES 118 IF(_arg_TOLUA_FILES) 119 GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files 120 INPUTFILES ${_arg_TOLUA_FILES}) 117 # QT MOC and UIC preprocessing 118 IF(_arg_QT_MOC_FILES) 119 QT4_WRAP_CPP(_${_target_name}_files ${_arg_QT_MOC_FILES}) 120 ENDIF() 121 IF(_arg_QT_UIC_FILES) 122 QT4_WRAP_UI(_${_target_name}_files ${_arg_QT_UIC_FILES}) 121 123 ENDIF() 122 124 … … 208 210 ENDIF() 209 211 210 # Configure modules211 IF (_arg_MODULE)212 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES213 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows214 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix215 )216 ADD_MODULE(${_target_name})217 # Ensure that the main program depends on the module218 SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE STRING "" FORCE)219 ENDIF()220 221 212 # LINK_LIBRARIES 222 213 IF(_arg_LINK_LIBRARIES) … … 251 242 # Install all targets except for static ones (executables also have SHARED in _link_mode) 252 243 IF(${_link_mode} STREQUAL "SHARED" AND NOT _arg_NO_INSTALL) 253 IF(_arg_MODULE) 254 INSTALL(TARGETS ${_target_name} 255 RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY} 256 LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY} 257 ) 258 ELSE() 259 INSTALL(TARGETS ${_target_name} 260 RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY} 261 LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY} 262 ) 263 ENDIF() 244 INSTALL(TARGETS ${_target_name} 245 RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY} 246 LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY} 247 ) 264 248 ENDIF() 265 249 266 250 ENDMACRO(TU_ADD_TARGET) 267 268 269 # Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}270 # This helps finding dynamically loadable modules at runtime271 272 FUNCTION(ADD_MODULE _target)273 # We use the properties to get the name because the librarys name may differ from274 # the target name (for example orxonox <-> liborxonox)275 276 GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)277 GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)278 279 IF(CMAKE_CONFIGURATION_TYPES)280 FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})281 SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})282 283 FILE(WRITE ${_module_filename})284 285 INSTALL(286 FILES ${_module_filename}287 DESTINATION ${MODULE_INSTALL_DIRECTORY}288 CONFIGURATIONS ${_config}289 )290 ENDFOREACH()291 ELSE()292 SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})293 294 FILE(WRITE ${_module_filename})295 296 INSTALL(297 FILES ${_module_filename}298 DESTINATION ${MODULE_INSTALL_DIRECTORY}299 )300 ENDIF()301 ENDFUNCTION(ADD_MODULE)
Note: See TracChangeset
for help on using the changeset viewer.