[CMake] distribute third party libs with NSIS

Michael Hertling mhertling at online.de
Tue May 18 08:20:23 EDT 2010


On 05/17/2010 08:41 PM, Michaël Presseau wrote:
> Hi, I have an application and I need to create an installer. I use CPack with NSIS. For now, I'm using :
> find_package(Boost COMPONENTS thread date_time filesystem REQUIRED)
> 
> This give me le .lib associate to the dll file. This is compiling and working on computer with Boost already install.
> 
> My problems occurs when I need to install the application on computer that doesn't have boost already install. What is the right way to do this.
> 
> I have the same problems with another third party libs called orocos. Here is what I've tried:
>         add_library(orocos-rtt-win32 SHARED IMPORTED)
> 
>         get_filename_component(OROCOS_RTT_LIBRARY_DIR ${OROCOS_RTT_LIBRARY} PATH)
> 
>         set_target_properties( orocos-rtt-win32 PROPERTIES
>                                                    IMPORTED_LOCATION "${OROCOS_RTT_LIBRARY_DIR}"
>                                                    IMPORTED_IMPLIB ${OROCOS_RTT_LIBRARY}
>                                                    IMPORT_SUFFIX ".dll"
>                                                    IMPORT_PREFIX ""
>         )
> 
>         install (TARGETS orocos-rtt-win32
>                RUNTIME DESTINATION ./
>                  LIBRARY DESTINATION ./
>                  ARCHIVE DESTINATION ./
>         )
> 
> And I've got the following message: CMake Error at MainGUI/CMakeLists.txt:50 (install):
>   install TARGETS given target "orocos-rtt-win32" which does not exist in
>   this directory.
> If I remove the install command of orocos-rtt-win32, the orocos-rtt-win32.lib is add correctely to the project. [...]

This means you can successfully link against it, but it does not become
part of your project; particularly, it isn't installed or even packaged
along with your project's other targets. Imported targets are intended
for being provided by other packages and used later by your project as,
say, logical targets, i.e. ADD_LIBRARY(... IMPORTED) doesn't introduce
an installable or buildable target into your project, but one you just
can link againts. In fact, that target or, more precisely, the related
binary is built and installed by another package which can't be pulled
in and made part of your project by declaring it as imported. Thus,
imported targets are probably less suitable for your concern. :(

Regards,

Michael


More information about the CMake mailing list