0

I have simple project in QtCreator with cmake which uses gtk. So i set compiler flags to this :-

set(CMAKE_CXX_FLAGS " -std=c++14 `pkg-config --cflags --libs gtk+-3.0`")

but it does not compile and gives me following output:-

Errors screenshot

:-1: error: error: `pkg-config: No such file or directory
:-1: error: error: gtk+-3.0`: No such file or directory
:-1: error: error: unrecognized command line option ‘--cflags’
:-1: error: error: unrecognized command line option ‘--libs’

here is my cmake file:-

cmake_minimum_required(VERSION 2.8)

project(untitled1)
set(CMAKE_CXX_FLAGS " -std=c++14 `pkg-config --cflags --libs gtk+-3.0`")


FIND_PACKAGE(PkgConfig REQUIRED)
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})

add_executable(${PROJECT_NAME} "main.cpp")
  • Possible duplicate of [CMake and pkg-config (juCi++)](https://stackoverflow.com/questions/42634710/cmake-and-pkg-config-juci) – Tsyvarev Mar 17 '18 at 18:24
  • Also related in terms of question content: [How to add compiler arguments using CMake?](https://stackoverflow.com/questions/27514291/how-to-add-compiler-arguments-using-cmake) – thomas_f Mar 17 '18 at 18:27

0 Answers0