[CMake] Linked Imported Library in Visual Studio Showing NOTFOUND

Petr Kmoch petr.kmoch at gmail.com
Wed Apr 17 07:50:08 EDT 2019


Hi Dustyn,

ELF platforms link against .so files, but Windows links against import
libraries (.lib files) assocaited with DLLs. Does the target 'bar' have the
IMPORTED_IMPLIB property set up correctly? (See
https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_IMPLIB.html )

Petr

On Tue, 16 Apr 2019 at 21:37, Dustyn Blasig <dustyn at blasig.us> wrote:

> 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!
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190417/02717b14/attachment.html>


More information about the CMake mailing list