[CMake] How to install an imported library?

Clement SOMMELET csommelet at gmail.com
Tue Jan 6 07:26:47 EST 2009


Thanks for your quick answer Andreas!

2009/1/6 Andreas Pakulat <apaku at gmx.de>:
> On 06.01.09 10:55:19, Clement SOMMELET wrote:
>> Hi, I try the following to install an imported dll:
>>
>> ADD_LIBRARY(Foo SHARED IMPORTED)
>> SET_TARGET_PROPERTIES(Foo PROPERTIES IMPORTED_LOCATION "C:/FooLocation/Foo.dll")
>> INSTALL(TARGETS Foo RUNTIME DESTINATION bin)
>>
>> and I get the following error:
>>
>> install TARGETS given target "Foo" which does not exist in this directory
>>
>> When looking into the cmake source code, it seems that INSTALL(TARGETS
>> ...) does not look for imported targets (it uses
>> cmMakefile::FindTarget and not cmMakefile::FindTargetToUse).
>>
>> Is it the expected behaviour?
>
> IMHO yes, the exporting and importing is geared towards using an already
> installed target. So there's no need to install it again.

Indeed, it sounds logical.

>> If yes what is the prefered way to
>> include an imported DLL in an install? A typical use case is when
>> importing a library built using cmake and the INSTALL(EXPORT ...)
>> command (generated cmakes contain ADD_LIBRARY(xxx SHARED IMPORTED)
>> commands)
>
> If somebody builds your project he'll need to install that external target
> before. In that case installing it again is useless and just wastes
> diskspace.

I agree too.

> So this would only be useful when using cpack to generate an installer for
> your project (or zip package) and as such it should IMHO be handled somehow
> by cpack. Maybe kitware didn't think of that yet, so you might want to file
> a wishlist report in their bugtracker.

I indeed mixed up installation and packaging.

> Andreas
>
> --
> Don't relax!  It's only your tension that's holding you together.
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list