Alexander Neundorf wrote:
On Tuesday 05 May 2009, alexandre.feb...@thomsonreuters.com wrote:
I saw this too.
IMHO, it's a bug. If it's a feature, I don't see the point.

I think it's a feature that imported targets are not global. Brad explained this in a mail not too long ago, but I don't remember the details.

It is a feature.  Generally imported targets are created by third-party
package configuration files loaded by find_package.  Anything defined by
these outside files needs to have directory-local scope just like a
variable.  Different subdirectories of your project could import the
same outside project with different versions or configuration settings
which change how the targets are defined.

I suggest creating a helper module that defines the imported target,
and including it in any subdirectory that needs it.

BTW, there was a bug in 2.6.3 and below that caused transitive linking
to an imported target from another directory to fail:

  # A/CMakeLists.txt
  add_library(xxx SHARED IMPORTED)
  add_library(mylib ...)
  target_link_libraries(mylib xxx)

  # B/CMakeLists.txt
  add_executable(myexe ...)
  target_link_libraries(myexe mylib)

The 'myexe' target should link to 'xxx' transitively through 'mylib', but
this failed in 2.6.3 and below.  It works with 2.6.4.

-Brad
_______________________________________________
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