[CMake] target_link_libraries fails dependencies

Alexander Neundorf a.neundorf-work at gmx.net
Thu Nov 15 15:20:00 EST 2012


On Wednesday 14 November 2012, Andrea Galeazzi wrote:
> I'm using cmake_policy(SET CMP0015 NEW) to link external libraries (I
> don't have the sources of them) in order to avoid to specify the
> absolute path of each library. So I wrote the following commands:
> link_directories(path1 path2 ...)
> target_link_libraries(${my_TARGET_NAME} lib1 lib2)

Whenever possible, you should use absolute paths to libraries.

CMP0015 actually does not change this.
The only thing it does, is that if you use a relative path, e.g. "mylibs/", 
then with CMP0015 set to OLD, this will be interpreted as 
${CMAKE_CURRENT_BINARY_DIR}/mylibs/, while with CMOP0015 set to NEW, it will 
be interpreted as ${CMAKE_CURRENT_SOURCE_DIR}/mylibs/

Alex


More information about the CMake mailing list