[CMake] strange feature(?) of library cmake generator and build types question

speedy speedy at 3d-io.com
Sat Jul 29 19:14:56 EDT 2006


Hello cmake crew,

  VC++ 6 generator -
  
  // find link libraries
  const cmTarget::LinkLibraryVectorType& libs = target.GetLinkLibraries();
  cmTarget::LinkLibraryVectorType::const_iterator j;
  for(j = libs.begin(); j != libs.end(); ++j)
    {
    // add libraries to executables and dlls (but never include
    // a library in a library, bad recursion)
    // NEVER LINK STATIC LIBRARIES TO OTHER STATIC LIBRARIES
    if ((target.GetType() != cmTarget::SHARED_LIBRARY
         && target.GetType() != cmTarget::STATIC_LIBRARY 
         && target.GetType() != cmTarget::MODULE_LIBRARY) || 
        (target.GetType()==cmTarget::SHARED_LIBRARY && libName != j->first) ||
        (target.GetType()==cmTarget::MODULE_LIBRARY && libName != j->first))
      {  

   Can anyone explain why is this restriction in place - it assumes
   that user would allways be linking target-to-target (which produces
   "bad recursion" - actually linking of the same output .lib twice
   because of VC++ built in project dependencies), but misses a valid
   use case when user is linking external .lib library to the target.

   I've actually stumbled on this path trying to separate linking of
   external libraries for different build types, which is supported
   only(?) by TARGET_LINK_LIBRARIES() debug & optimized keywords.

   Is there any other way to specify target source files which are
   specificaly bound to a certain build type?

   ie. I want debug.cpp & debug.lib to be excluded from all but
   "Debug" build type?
      
-- 
Best regards,
 speedy                          mailto:speedy at 3d-io.com



More information about the CMake mailing list