[CMake] How to include libraries from classic toolchain to be installed and/or packaged?

Eric Noulard eric.noulard at gmail.com
Mon May 30 16:53:09 EDT 2011


2011/5/30 Jan Dolecek <juzna.cz at gmail.com>:
> Hi guys,
> I like CMake and I'm trying to learn it, however I have problem with my
> project which I'm not able to solve for couple of days. The problem is, that
> my project depends on another library which I need to compile and which uses
> classic toolchain (autoconf + configure). This library automatically
> compiles other libraries which are also needed. I managed to build these
> libraries manually and link them to my project just by adding relative path
> to them to target_link_libraries. It's get compiled well.
> However I also need "make install" to work, or especially "make package"
> which internally uses install targets. This install however installs only my
> app, not the libraries needed :(
> I tried:
> add_library(LIB_CORE SHARED IMPORTED)
> set_property(TARGET LIB_CORE PROPERTY IMPORTED_LOCATION path_to_library.so)
> target_link_libraries(MY_PROJECT LIB_CORE)
> install(TARGETS ${LIB_CORE} LIBRARY DESTINATION lib)
> which will compile everything well bus just ignore the library when "make
> install" or  "make package"
>
> I tried it another way:
> install(PROGRAMS ${LIBS_PATH} DESTINATION lib)
> which doesn't work either, because LIBS_PATH has path to shared libraries
> which are only symlinks to real files (real files has version in filename).
> And only this symlinks are copied, without actual library.
>
> What is the right way to include 3rd party libraries into my
> install/package?
> Thanks

I'm not using it but I think you should have a look at

BundleUtilities
cmake --help-module BundleUtilities
and
ExternalProject
cmake --help-module ExternalProject

May be some user of those modules will give you more detailed advices.
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list