I cannot link external library to my project
I have the following CMakeLists
file
add_executable(MyProg main.cpp)
LINK_DIRECTORIES(winlib)
message(STATUS "SND FILE ${libsndfile}")
# Link
target_link_libraries(
MyProg
libsndfile)
I have downloaded libsndfile
library, however cmake was not able to resolve it using the find_library
function.
So I copied and renamed libsndfile-1.lib
to my source directory
And now my project structure looks as follows
--
----winlib
------libsndfile.lib
----main.cpp
----otherfiles
When I try to build the project I get the following error
Error LNK1104 cannot open file 'libsndfile.lib' C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CMakeLists.txt C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\LINK 1
What is wrong with my project, how can I link this library ?