[CMake] target_link_libraries is using relative path of library
Saad Khattak
saadrustam at gmail.com
Sat Jan 7 22:01:35 EST 2017
Hello,
This is a very strange behavior I am encountering. I am using CMake 3.7.1
with Visual Studio 2015. I have the following as part of a CMakeLists file:
find_library(glfw_LIB_D glfw3_d ${glfw_LIBRARIES})
find_library(glfw_LIB glfw3 ${glfw_LIBRARIES})
When I do "message(STATUS ${glfw_LIB_D})" I get the full absolute path.
However, when I add an executable that depends on the library:
add_executable(vk_test src/vulkan_test.cpp )
target_link_libraries(vk_test ${glfw_LIB_D})
CMake puts the relative path when I look at my project's project properties:
..\install\glfw\lib\glfw_d.lib
I also tried the following:
target_link_libraries(vk_test
"${CMAKE_SOURCE_DIR}/install/glfw/lib/glfw_d.lib")
And it's still a relative path. Because of this issue, my project will not
compile as Visual Studio is looking for the library in the incorrect folder.
I even set the following, thinking that somehow relative paths got set:
set(${CMAKE_USE_RELATIVE_PATHS} FALSE FORCE)
I still got the same relative path. What is going on?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170108/9c3bafeb/attachment.html>
More information about the CMake
mailing list