sdl2-net provides CMake targets: find_package(SDL2_net CONFIG REQUIRED) target_link_libraries(main PRIVATE $,SDL2_net::SDL2_net,SDL2_net::SDL2_net-static>)