How to add “-l” (ell) compiler flag in CMake

前端 未结 2 1016
长发绾君心
长发绾君心 2020-11-22 00:16

Work on Ubuntu 16

I used g++ main.cpp -lpq command for compiler my small project. Now I use Clion and wanna do same what I do with g++

2条回答
  •  春和景丽
    2020-11-22 00:56

    Flag -l is for linker, not for compiler. This flag is used for link with libraries. CMake has special command target_link_libraries for that purpose:

    target_link_libraries(day_g pq)
    

提交回复
热议问题