[CMake] Problem with shared libraries

Marco Spatz marco.spatz at icido.de
Thu Sep 15 06:08:36 EDT 2005


Hi,

I found the reason for this behavior, and want to make sure, that what I 
am doing is legal before submitting this to the bug tracker:

The reason is that we are changing the LIBRARY_OUTPUT_PATH several times 
in the project, because we want to put each plugin lib in its own directory.

For example:

set LIBRARY_OUTPUT_PATH to project/foo

build shared lib foo (now located in project/foo)

change LIBRARY_OUTPUT_PATH to project/bar

build shared lib bar


CMake 2.2 seems to store foo like ($LIBRARY_OUTPUT_PATH/libfoo.so)

If bar needs to be linked to libfoo.so, the LIBRARY_OUTPUT_PATH has 
changed, and the linker thinks libfoo.so must be in /project/bar/libfoo.so

Now again, is it ok to change the LIBRARY_OUTPUT_PATH during the project?

Ciao,
Marco


Brad King wrote:
> Marco Spatz wrote:
>> But if I change the line
>>
>> TARGET_LINK_LIBRARIES(idoCheckLicense dl pthread IDOBase)
>>
>> to
>>
>> TARGET_LINK_LIBRARIES(idoCheckLicense dl pthread libIDOBase.so)
>>
>> everthing works fine. But I don't want to step through the whole 
>> project and change every single cmake file if it isn't necessary.
>>
>> Is this a bug in cmake? Or is there some error in my code?
> 
> It looks like a bug in CMake...you should not have to know the shared 
> library prefix (lib) and suffix (.so) to link to the library.  Please 
> try to strip this down to a minimal source tree duplicating the problem 
> and submit a report to the bug tracker:
> 
> http://www.cmake.org/Bug
> 
> Thanks,
> -Brad


More information about the CMake mailing list