[CMake] Define a library target without using the add_librarycommand ? => Working with repositories => IMPORTED targets

Alexandre Feblot Alexandre.Feblot at thomsonreuters.com
Thu Jan 15 11:03:28 EST 2009


Thanks for that suggestion; I had read it in the cmake book addendum,
then forgot about it.

Exporting in the reference build tree made the trick. No exactly what I
want though, as it stores absolute path so I can't move it afterwards,
but I can correct that with a perl script.

 

It also exports library dependency information, which is exactly and
mostly what I needed.

 

One small issue:

 

In my test example, I have lib1 depending on lib2 depending on lib3
depending on lib1.

 

Exporting libs 1 and 2 works fine.

Exporting lib3 outputs the following error, although it generates the
correct export file. I do need to have a different export file for each
lib, so I can't use the APPEND option:

 

    CMake Error at lib3/CMakeLists.txt:16 (export):

      export called with target "3" which requires target "1" that is
not in the

      export list.

 

      If the required target is not easy to reference in this call,
consider

      using the APPEND option with multiple separate calls.

 

Would there be a way to avoid this error?

 

Regards,

Alexandre

 

-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
Of Andreas Pakulat
Sent: Monday, 12 January 2009 14:38
To: cmake at cmake.org
Subject: Re: [CMake] Define a library target without using the
add_librarycommand ? <==> Working with repositories

 

On 12.01.09 11:27:29, Alexandre Feblot wrote:

> Is there a way to define a library target, on which I could use

> target_link_libraries(), without creating/building this library, i.e.

> without defining it with add_library(), but with add_custom_target for

> instance ?

 

In CMake 2.6 you can export and import targets, which might be an
option.

The CMake manual tells you more about this, just look for install and

EXPORT.

 

Andreas

 

-- 

You will be advanced socially, without any special effort on your part.

_______________________________________________

CMake mailing list

CMake at cmake.org

http://www.cmake.org/mailman/listinfo/cmake

 



This email was sent to you by Thomson Reuters, the global news and information company.
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090115/ac5bf730/attachment-0001.htm>


More information about the CMake mailing list