[CMake] Linked Imported Library in Visual Studio Showing NOTFOUND

Dustyn Blasig dustyn at blasig.us
Tue Apr 16 15:37:20 EDT 2019


Hi All,

I'm trying to debug an issues where an imported shared library is showing
up in the linker command as not found, but within the CMake generation the
target seems to exist.

# CMakeLists.txt ####################

include(bar.cmake)

add_library(foo SHARED)

if(TARGET bar)
  target_link_libraries(foo PUBLIC bar)
endif()

# bar.cmake #######################

add_library(bar SHARED IMPORTED)

...


On Linux, the link command contains the correct *-L<bar path>* and *-lbar*
options. However, on Windows (Visual Studio) the linker command has
"bar-NOTFOUND" instead of bar.lib as it should, even though bar should only
be added as a dependency *if* it exists.

How can I debug why this would happen? Is there a way to have CMake dump
more information about that target?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190416/1ea3680c/attachment.html>


More information about the CMake mailing list