CMake file link_directories () the use of a relative path failure

When re-compile the project today, I encountered this problem:

Policy CMP0015 is not set: link_directories() treats paths relative to the source dir.

Saw this one blog
to solve this problem, the core is as follows:

In CMake 2.8.0 and lower the link_directories() command passed relative paths unchanged to the linker. In CMake 2.8.1 and above the link_directories() command prefers to interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, which is consistent with include_directories() and other commands. The OLD behavior for this policy is to use relative paths verbatim in the linker command. The NEW behavior for this policy is to convert relative paths to absolute paths by appending the relative path to CMAKE_CURRENT_SOURCE_DIR.

When using CMAKE_CURRENT_SOURCE_DIR when CMake 2.8.1 and above load dynamic link library link_directories () modification of the path link; 2.8.0 version of the following CMake, used to load dynamic link library link_directories () relative path, use the relative path link first converted into an absolute path and then link to it.

Guess you like

Origin www.cnblogs.com/walnuttree/p/11595206.html