Pheeew..
So I've now been trying to include one *single* library from an
external project (liba.a) into my own project, writing FindA.cmake.
Somehow I still fail to apply the dependencies correctly. What I do is

[...]
ADD_LIBRARY(A STATIC IMPORTED)
SET_TARGET_PROPERTIES( A PROPERTIES
                                             IMPORTED_LOCATION
"${A_LIBRARY}"     %set above
                                             LINK_INTERFACE_LIBRARIES
"${A_LINK_INTERFACE_LIBRARIES}"   % set above to something like
"/usr/lib/liblapack.a;/usr/lib/blas.a;"
                       )
[...]

[Setting TARGET_LINK_LIBRARIES(A LINK_INTERFACE_LIBRARIES
"${A_LINK_INTERFACE_LIBRARIES}" ) did *not* work for me.]

Now,  in the main CMakeLists.txt I say Find( A REQUIRED ), and I was
naivly expecting that upon

TARGET_LINK_LIBRARIES ( main.out A )

*all* the dependent libraries would be pulled in too. This is not the case. :/

What am I missing?

Cheers,
Nico





On Fri, Jan 8, 2010 at 11:00 AM, Nico Schlömer <nico.schloe...@gmail.com> wrote:
> Hi,
>
>> I am guessing that
>> you're putting the detection for every library that your app can/must use
>> into one "find" module, when you actually probably should have a directory
>> in your source tree added to your CMAKE_MODULE_PATH that contains a large
>> number of find modules, some of which are interdependent (just like how the
>> example I sent uses find_package(BLAS) - which is a module that comes
>> bundled with cmake).
>
> -- Exactly!
>
> I'm thinking now that this is indeed a good solution: Writing
> *separate* FindLibraryX.cmake files for all the libraries included in
> MyPackage and putting all the dependency information in there; then,
> make a meta .cmake file which will allow for specifying the keyword
> COMPONENTS, and where all the meta information goes (e.g., version
> number of MyPackage).
>
> Minor drawbacks of this approach I find would be that the fact that
> all those libraries live under one roof is entirely discarded, that
> is, that they all share a common LIB directory, INCLUDE directory, all
> have the same version string (namely the one of MyPackage). Plus also,
> new libraries included require their own new FindNewLib.cmake to be
> created, while all FindLibrary*.cmake would actually be the same file,
> except for the dependency info (nasty (?) code duplication).
>
> How I came to think about COMPONENTS in the first place was looking at
> FindBoost.cmake which I *thought does what I'm doing -- except for the
> intercomponent linking info.
>
> Cheers!
> Nico
>
_______________________________________________
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