I want to set up the build in QtCreator via CMake. How to add a library to a project? for example winsock2

CMakeLists:

project(untitled26) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) 

    1 answer 1

    To connect the libraries, the target_link_libraries macro is target_link_libraries , the parameters of which are the target project and the list of connected libraries. Libraries are specified without the standard 'lib' prefix.
    Connection example libSDL2 SDL2-image

     target_link_libraries(${PROJECT_NAME} SDL2 SDL2_image) 

    More you can read, for example, on Habré