[CMake] visual studio tries to link to non-existent static version of lib

Jack Stalnaker jack.stalnaker at gmail.com
Tue Aug 23 15:36:23 EDT 2016


The following works on Linux, for both GNU and Intel compilers:

add_library(mylib SHARED ${mylib_sources})
target_link_libraries(mylib ${mylib_libraries})
...
add_executable(test_mylib test_mylib.c)
target_link_libraries(test_mylib mylib ${test_mylib_libraries})
add_test (TestMylib test_mylib)


However on windows, using Visual Studio, building test_mylib fails with the
message "cannot open file Debug\mylib.lib".  But I have not asked for a
static library, and I'm not sure why VS is trying to link to it. Is there
some extra step I need to take to make this work on Windows?

--Jack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160823/19599163/attachment.html>


More information about the CMake mailing list