[CMake] policy CMP0003 and full path, but still conflict with implicit directories

PG goued120 at yahoo.fr
Thu Feb 25 16:28:19 EST 2010



Quoting PG on 02/24/2010 06:00 PM:
>
> Hi Bill,
>
>> Can you create a small example that shows the problem you are having?
>
> what do you mean by a small example? A simple CMakeList.txt file with
> some code to compile?
> I will try to to this with some code anyone could compile, but it may
> take me some time as I am booked with other things.

I tried to create a simple example with 2 libraries A and B organized as 
described in my first email, and couldn't reproduce the error.

I finally discovered that my problem was linked to the particular 
library B I was using (the libmat.so library from Matlab, for those who 
wonder), and that by setting CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME to 
OFF the full path to B was kept.

I don't really understand what this variable changes in the cmake 
behaviour, but when set to ON cmake split the library full path in a 
link search directory (and seems to put the -L at the beginning of the 
linked library list) and a -l flag.

So now I have in the link.txt file a line that looks like:
   /usr/bin/c++ [...] -lA /some/path/B -Wl,-rpath,/some/path
and cmake complains about not being able to generate a safe runtime 
search path...

CMake Warning at CMakeLists.txt:77 (add_executable):
   Cannot generate a safe runtime search path for target target because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [A] in /usr/lib may be hidden by files in:
       /some/path

   Some of these libraries may not be found correctly.


As I am not very familiar with these rpath things, I don't know what to 
do with this runtime path warning.


Pierre


More information about the CMake mailing list