[CMake] How to install an imported library?

Clement SOMMELET csommelet at gmail.com
Tue Jan 6 04:55:19 EST 2009


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? 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)

Thanks,
Clément Sommelet


More information about the CMake mailing list