How to bind winsock in cmake?

I found only these lines

find_library(WSOCK32_LIBRARY wsock32) find_library(WS2_32_LIBRARY ws2_32) 

(I start in cmake) how to bind winsock2 (winsock?) in cmake?

+8
c ++ cmake winsock
source share
1 answer

Since this is part of the Windows SDK, you do not need to look for them. Assuming you have the SDK installed, you can simply do something like:

 add_executable(MyExe main.cpp) if(WIN32) target_link_libraries(MyExe wsock32 ws2_32) endif() 
+16
source share

All Articles