title: Link target to libraries
body: <p>I have a "CMakified" version of CryptoPP and I am using CMake-GUI to create a MakeFile which ming-make could process as shown in the image below.<br>
  <br></p>
  
  <p><img src="https://i.stack.imgur.com/KxusC.png" alt="enter image description here"></p>
  
  <p>The "MakeFile" creation was successful but when I executed <code>mingw32-make.exe</code> I got below errors at the very end.</p>
  
  <pre><code>Linking CXX executable cryptest.exe
  CMakeFiles\cryptest.dir/objects.a(test.cpp.obj):test.cpp:(.text+0x8e82): undefined reference to `setsockopt@20'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x5cb): undefined reference to `socket@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x643): undefined reference to `closesocket@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x6f0): undefined reference to `htonl@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x70a): undefined reference to `inet_addr@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x759): undefined reference to `htons@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x7f4): undefined reference to `bind@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x85b): undefined reference to `listen@8'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x909): undefined reference to `inet_addr@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x922): undefined reference to `gethostbyname@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x978): undefined reference to `htons@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xa18): undefined reference to `connect@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xaac): undefined reference to `accept@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xb58): undefined reference to `getsockname@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xbc6): undefined reference to `getpeername@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xc87): undefined reference to `send@16'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xd83): undefined reference to `recv@16'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xe25): undefined reference to `shutdown@8'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xe96): undefined reference to `ioctlsocket@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xfbb): undefined reference to `select@20'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1010): undefined reference to `select@20'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x11a1): undefined reference to `select@20'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x11f6): undefined reference to `select@20'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x133f): undefined reference to `getservbyname@8'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1407): undefined reference to `ntohs@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1526): undefined reference to `WSAStartup@8'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x16cf): undefined reference to `WSACleanup@0'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x17fb): undefined reference to `WSAGetLastError@0'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x180f): undefined reference to `WSASetLastError@4'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1cfc): undefined reference to `WSARecv@28'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1d27): undefined reference to `WSAGetLastError@0'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1f61): undefined reference to `WSAGetOverlappedResult@20'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1f8c): undefined reference to `WSAGetLastError@0'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x2397): undefined reference to `WSASend@28'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x23c1): undefined reference to `WSAGetLastError@0'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x24cc): undefined reference to `WSAEventSelect@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x2587): undefined reference to `WSAEnumNetworkEvents@12'
  libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x2a01): undefined reference to `WSAGetOverlappedResult@20'
  collect2.exe: error: ld returned 1 exit status
  mingw32-make[2]: *** [cryptest.exe] Error 1
  mingw32-make[1]: *** [CMakeFiles/cryptest.dir/all] Error 2
  mingw32-make: *** [all] Error 2
  </code></pre>
  
  <p>I tried adding <code>LDLIBS += -lws2_32</code> to the very end of the make file but this didn't help. I guess these errors are because the target link libraries are not mentioned in the make file but I am not sure how to do this.</p>