[CMake] Dynamic libraries and library dependencies

Stefan Buschmann s_buschmann at gmx.de
Thu Feb 1 16:50:56 EST 2007


Bill Hoffman wrote:
>> Now, when building the project, cmake tries to link libFoo to the
>> sample application instead of linking it to the dynamic library
>> (which is explained in the cmake faq). So it adds -lFoo to the
>> command line, but that library can't be found because the path to the
>> library is unknown (Project/SharedLib/external/lib) as this is only
>> defined in the SharedLib/CMakeLists.txt, but not inside
>> SampleApp/CMakeLists.txt.
>> So, is there a way to solve this without having to add the library
>> path to every dependent project (which would in fact make the library
>> abstraction useless)?
> Try putting the full path to Foo.  SET(PROJECT_LIBS
> ${Project_SOURCE_DIR}/external/lib/libFoo.a)
>
> -Bill
>

Worked perfectly :-) Thanks.

Stefan



More information about the CMake mailing list