I want to implement a simple server on a Windows system. I get a problem that I can't successfully compile it in CMake, because I don't know how to link ws2_32.lib to it. With gcc/g++, my command
g++ -g -o myhttp ../src/main.cpp ../src/start_up.cpp -I ../inc -lws2_32
runs well, but in CMake I don't know how to operate.
The following is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.2)
project(MYHTTP_BASE_C++)
set(CMAKE_PROGRAM_PATH ${CMAKE_SOURCE_DIR}/bin)
include_directories(${CMAKE_SOURCE_DIR}/inc)
find_package("ws2_32.lib")
target_link_libraries( SRC)
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
add_executable(myhttp ${SRC})
The error is
CMake Error at CMakeLists.txt:7 (target_link_libraries):
Cannot specify link libraries for target "ws2_32.lib" which is not built by
this project