Show
Ignore:
Timestamp:
03/08/11 14:51:13 (3 years ago)
Author:
robert
Message:

From Rafa Gaitan, "I have added the macro SETUP_LIBRARY, similar to SETUP_PLUGIN or
SETUP_EXE, in order to have a unique entry point to build the
libraries. With this changes the android integration will be less
painful (currently is a big IF(ANDROID) for each CMakeLists.txt) and
more maintainable in the future. I hope next submissions will be for
supporting android from my colleague Jorge.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeModules/OsgMacroUtils.cmake

    r11904 r12208  
    197197ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR) 
    198198 
     199 
     200 
     201####################################################################################################### 
     202#  macro for common setup of libraries it expect some variables to be set: 
     203#  either within the local CMakeLists or higher in hierarchy 
     204#  LIB_NAME  is the name of the target library 
     205#  TARGET_SRC  are the sources of the target 
     206#  TARGET_H are the eventual headers of the target 
     207#  TARGET_LIBRARIES are the libraries to link to that are internal to the project and have d suffix for debug 
     208#  TARGET_EXTERNAL_LIBRARIES are external libraries and are not differentiated with d suffix 
     209#  TARGET_LABEL is the label IDE should show up for targets 
     210########################################################################################################## 
     211 
     212MACRO(SETUP_LIBRARY LIB_NAME) 
     213 
     214    SET(TARGET_NAME ${LIB_NAME} ) 
     215    SET(TARGET_TARGETNAME ${LIB_NAME} ) 
     216 
     217    ADD_LIBRARY(${LIB_NAME} 
     218        ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} 
     219        ${TARGET_H} 
     220        ${TARGET_SRC} 
     221    ) 
     222     
     223    IF(TARGET_LABEL) 
     224        SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}") 
     225    ENDIF(TARGET_LABEL) 
     226     
     227    IF(TARGET_LIBRARIES) 
     228        LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES}) 
     229    ENDIF() 
     230    IF(TARGET_EXTERNAL_LIBRARIES) 
     231        LINK_EXTERNAL(${LIB_NAME} ${TARGET_EXTERNAL_LIBRARIES}) 
     232    ENDIF() 
     233    IF(TARGET_LIBRARIES_VARS) 
     234        LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS}) 
     235    ENDIF(TARGET_LIBRARIES_VARS) 
     236    LINK_CORELIB_DEFAULT(${LIB_NAME}) 
     237     
     238    INCLUDE(ModuleInstall OPTIONAL) 
     239 
     240ENDMACRO(SETUP_LIBRARY LIB_NAME) 
    199241 
    200242MACRO(SETUP_PLUGIN PLUGIN_NAME)