Re: [CMake] Install an executable with his libraries

2012-01-19 Thread Eric Noulard
2012/1/19 Anthony Todisco :
> Thank you Eric for this link, but I don't really understand how to use RPATH
> with CMake.

The RPATH usage control with CMake is done using
4 variables:

CMAKE_SKIP_BUILD_RPATH
CMAKE_BUILD_WITH_INSTALL_RPATH
CMAKE_INSTALL_RPATH
CMAKE_INSTALL_RPATH_USE_LINK_PATH

you can get the document of each of those vars with

cmake --help-variable 

> Could you provide me piece of advice for my case?

RPATH is a Unix way to put inside a binary executable
an explicit link to the libraries on which this executable depends.

In your case the "Manager" executable depends on
the "BaseLib, ComposeLib and phtread" as stated by
your
target_link_libraries(
   Manager
   BaseLib
   ComposeLib
   pthread
)

when you run "Manager" the system thus need to load
the BaseLib, ComposeLib and phtread libs.

phtread is [probably] found automatically because it is installed
system-wide and I won't explain that.

BaseLib and ComposeLib are built in your project.

CMake knows all of this, then:

in the build tree it uses RPATH in order to make
Manager run easily without fiddling with LD_LIBRARY_PATH.

At the install location (/usr/local/... in your case)
CMake does not setup RPATH inside the **installed** executable
unless you tell him to do so, by specifying the install rpath:
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

from "http://www.cmake.org/Wiki/CMake_RPATH_handling";
you can read
"when installing all executables and shared libraries will be
relinked, so they will find all libraries they need"

by the way you should NOT do that:

#Define link libraries folder
link_directories(../../Bin/${BUILD_PATH})

this should not be necessary, see:

cmake --help-command link_directories
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Install an executable with his libraries

2012-01-19 Thread Anthony Todisco
Thank you Eric for this link, but I don't really understand how to use
RPATH with CMake.

Could you provide me piece of advice for my case?


2012/1/18 Eric Noulard 

> 2012/1/18 Anthony Todisco :
> > Thank you very much, it works fine now :D.
> >
> > I've missed this step :/
>
> On Unix you can configure RPATH in order to avoid the LD_LIBRARY_PATH
> update
> and/or tolerate more easily multiple version of the same lib for
> different executable.
>
> Have a look at:
> http://www.cmake.org/Wiki/CMake_RPATH_handling
>
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Install an executable with his libraries

2012-01-18 Thread Eric Noulard
2012/1/18 Anthony Todisco :
> Thank you very much, it works fine now :D.
>
> I've missed this step :/

On Unix you can configure RPATH in order to avoid the LD_LIBRARY_PATH update
and/or tolerate more easily multiple version of the same lib for
different executable.

Have a look at:
http://www.cmake.org/Wiki/CMake_RPATH_handling


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Install an executable with his libraries

2012-01-18 Thread Anthony Todisco
Thank you very much, it works fine now :D.

I've missed this step :/

2012/1/18 Rolf Eike Beer 

> > Hello,
> >
> > I'm new with CMake and for a project I try to build and install a
> program.
> > I've done some research on the forum and try what have found but nothing
> > seems to work :/.
>
> [...]
>
> > The build works fine and if I launch manager on the bin directory from
> the
> > build tree, there is no problem. However, when I use make install, all
> the
> > files are correctly installed /usr/local/lib and /usr/local/bin but I
> > can't
> > launch Manager exectuable. A message informs me that the executable can't
> > find BaseLib.so.
> >
> > I don't know where my error is :/.
>
> export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
>
> Eike
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Install an executable with his libraries

2012-01-18 Thread Rolf Eike Beer
> Hello,
>
> I'm new with CMake and for a project I try to build and install a program.
> I've done some research on the forum and try what have found but nothing
> seems to work :/.

[...]

> The build works fine and if I launch manager on the bin directory from the
> build tree, there is no problem. However, when I use make install, all the
> files are correctly installed /usr/local/lib and /usr/local/bin but I
> can't
> launch Manager exectuable. A message informs me that the executable can't
> find BaseLib.so.
>
> I don't know where my error is :/.

export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

Eike
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake