Work on Ubuntu 16
I used the command g++ main.cpp -lpqto compile my small project. Now I am using Clion and want to do the same thing that I am with g++. But I can not add compiler flags to the cmake file and get a compilation error.
cmake_minimum_required(VERSION 3.5.1)
project(day_g)
set(CMAKE_CXX_FLAGS "-lpq")
add_definitions(-lpq)
message("CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
add_executable(day_g ${SOURCE_FILES})
Also I only run the cmake file and get CMAKE_CXX_FLAGSwith the -lpq flag.
CMAKE_CXX_FLAGS is -lpq
-- Configuring done
-- Generating done
How to correctly add compiler flags to cmake file?
source
share