[CMake] CMAKE -- MAKE problem -- TARGET_LINK_LIBRARIES related

Alexander Neundorf a.neundorf-work at gmx.net
Wed May 19 16:28:16 EDT 2010


On Tuesday 18 May 2010, Lucian Goron wrote:
> this is my problem.. it tells me that it can not find the levmar package:
>
> lucian at schwarz:~/work/ransac$ make
> Linking CXX executable TestAcquireGPS
> /usr/bin/ld: cannot find -llevmar
> collect2: ld returned 1 exit status
> make[2]: *** [TestAcquireGPS] Error 1
> make[1]: *** [CMakeFiles/TestAcquireGPS.dir/all] Error 2
> make: *** [all] Error 2
> lucian at schwarz:~/work/ransac$
>
> but, in my CMakeLists.txt file I have the following lines:
>
> INCLUDE_DIRECTORIES (../common/levmar)
> LINK_DIRECTORIES (../../common/levmar)

In cmake < 2.8.1, relative paths in LINK_DIRECTORIES() are interpreted as 
relative to CMAKE_CURRENT_BUILD_DIR, while relative paths in 
include_directories() are interpreted as relative to 
CMAKE_CURRENT_SOURCE_DIR.
Since cmake 2.8.1 there is the cmake policy CMP0015 which controls this 
behaviour, if set to NEW, also in LINK_DIRECTORIES() relative paths are 
treated as relative to CMAKE_CURRENT_SOURCE_DIR.

But as Michael wrote, prefer to use the full path to the library.

Alex


More information about the CMake mailing list