Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I found only this strings
find_library(WSOCK32_LIBRARY wsock32) find_library(WS2_32_LIBRARY ws2_32)
(i'm begginer in cmake) how to link winsock2 (winsock?) in cmake?
由于它们都是 Windows SDK 的一部分,因此您不需要搜索它们。假设您安装了 SDK,您可以执行以下操作:
add_executable(MyExe main.cpp) if(WIN32) target_link_libraries(MyExe wsock32 ws2_32) endif()