Hi,

I have several imported libraries:

LibA
LibB
LibC

Where each imported library has been populated by (where ${LIB_NAME} is
either LibA, LibB or LibC):

add_library(${LIB_NAME} STATIC IMPORTED)

And each library has the properties IMPORT_LOCATION_${CONFIGURATION} set
properly:

set_target_properties(${LIB_NAME}
    PROPERTIES IMPORTED_LOCATION_DEBUG # same for release
   "location/of/library.lib"
    )

Now let's say I have another imported library LibD that depends on LibA and
LibB such that any executable that uses LibD must also link with LibA and
LibB. To do that, I use:

set_target_properties(LibD
  PROPERTIES
    IMPORTED_LINK_INTERFACE_LIBRARIES LibA LibB
  )

However, the above syntax is incorrect and CMake complains that
SET_TARGET_PROPERTIES was called with incorrect number of arguments.

So I thought maybe the following will work:

set_target_properties(LibD
  PROPERTIES
    IMPORTED_LINK_INTERFACE_LIBRARIES LibA
    IMPORTED_LINK_INTERFACE_LIBRARIES LibB
  )

Although this time CMake doesn't complaint, only LibB's libraries are
linked ultimately, LibA is overwritten. Doing the following, of course,
doesn't work because LibA is now an imported library and not exactly a
variable that can be used directly:

set_target_properties(LibD
  PROPERTIES
    IMPORTED_LINK_INTERFACE_LIBRARIES "${LibA};${LibB}" # not correct
because LibA and LibB are CMake imported libraries, not direct paths to
libraries
  )

Is there any way to specify, for an imported target, multiple dependencies
on other libraries (and/or dependencies on other imported libraries).

Thanks,
Saad
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to