On Thu, Jan 7, 2010 at 4:00 PM, Jed Brown <j...@59a2.org> wrote: > On Thu, 07 Jan 2010 15:54:33 -0600, Ryan Pavlik <rpav...@iastate.edu> > wrote: > > If you use the _LIBRARIES variable, you don't need to even mess around > > with the imported targets thing > > Dumping recursive dependencies in *_LIBRARIES causes overlinking, they > should only be there when linking statically. > > Jed >
So then actually should we all be doing imported targets in our find modules then? I didn't realize it: most of the ones I looked at that come with cmake didn't use it, so I just worked around it - wrote a function that can safely remove those dupes instead :) Is there any drawback (besides slightly longer code) to doing the imported targets route? Here's that CleanLibraryList.cmake file: # - A smarter replacement for list(REMOVE_DUPLICATES) for library lists # # clean_library_list(<listvar> [<additional list items>...]) - where # WHATEVER_LIBRARIES is the name of a variable, such as a variable being # created in a Find script. # # Removes duplicates from the list then sorts while preserving "optimized", # "debug", and "general" labeling # # Requires CMake 2.6 or newer (uses the 'function' command) # # Original Author: # 2009-2010 Ryan Pavlik <rpav...@iastate.edu> <abir...@ryand.net> # http://academic.cleardefinition.com # Iowa State University HCI Graduate Program/VRAC function(clean_library_list _var) # combine variable's current value with additional list items set(_work ${${_var}} ${ARGN}) if(_work) # Turn each of optimized, debug, and general into flags # prefixed on their respective library (combining list items) string(REGEX REPLACE "optimized;" "1CLL%O%" _work "${_work}") string(REGEX REPLACE "debug;" "1CLL%D%" _work "${_work}") string(REGEX REPLACE "general;" "1CLL%G%" _work "${_work}") # clean up list list(REMOVE_DUPLICATES _work) list(SORT _work) # Split list items back out again: turn prefixes into the # library type flags. string(REGEX REPLACE "1CLL%G%" "general;" _work "${_work}") string(REGEX REPLACE "1CLL%D%" "debug;" _work "${_work}") string(REGEX REPLACE "1CLL%O%" "optimized;" _work "${_work}") # Return _work set(${_var} ${_work} PARENT_SCOPE) endif() endfunction() -- Ryan Pavlik HCI Graduate Student Virtual Reality Applications Center Iowa State University rpav...@iastate.edu http://academic.cleardefinition.com Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
_______________________________________________ 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