nevermind I've figured out a generic way to do what I need, build once and
link in multiple locations.

MACRO ( SRC_TARGET_REF _TARGET _REFS_EXPR _SRCREFS )

# 1st obtain the srcs
 get_target_property ( _LSRCS ${_TARGET} SOURCES )

#loop through srouces and check matches
 foreach ( _TARGET_SRC_FILE ${_LSRCS} )

#for each src file check all refs.
 foreach ( _REF ${_REFS_EXPR} )

# if matches
if(${_TARGET_SRC_FILE} MATCHES ${_REF})

if(${_SRCREFS})
set (${_SRCREFS} "${${_SRCREFS}};${_TARGET_SRC_FILE}")
 else(${_SRCREFS})
set (${_SRCREFS} ${_TARGET_SRC_FILE})
endif(${_SRCREFS})

endif()

endforeach( _REF )
endforeach( _TARGET_SRC_FILE )

ENDMACRO ( SRC_TARGET_REF )

############################################
## begin excerpt

src_target_ref( small_lib "^.*$" SMALL_LIB_REFS)
add_library( big_mundge_redistro_lib STATIC blah_blah.cpp;${SMALL_LIB_REFS}
)
add_dependencies (big_mundge_redistro_lib small_lib)

On Thu, Sep 9, 2010 at 11:19 AM, Tim St. Clair <[email protected]> wrote:

> From within cmake I see a generation of the .o targets in my makefile, is
> there any way to get a listing without shelling out to ar?
>
> --
> Cheers,
> Timothy St. Clair
>
>


-- 
Cheers,
Timothy St. Clair
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to