Clion, cMake and POCO

前端 未结 2 742
不知归路
不知归路 2021-01-03 14:20

I\'m a new guy to c++ and cmake here. I decided to test out cLion and cMake. I\'m trying to write a simple email client for the command line. Other sources told me that the

2条回答
  •  春和景丽
    2021-01-03 15:09

    My CMakeLists.txt for using Poco looks like this:

    cmake_minimum_required(VERSION 3.10.0)
    project(MyProject VERSION 0.1.0)
    
    
    find_package(Poco REQUIRED COMPONENTS Foundation Net Zip )
    
    add_executable(my_exe main.cpp)
    
    
    target_link_libraries(my_exe PUBLIC Poco::Foundation Poco::Zip Poco::Net)
    

    This configuration automatically add the needed include directories and libraries. The Foundation component is mandatory, it seems it provides the include directories.

    Don't add Poco to target_link_libraries, the linker will then look for a 'Poco' library.

提交回复
热议问题