#adding library to cmake gtk project

2 messages · Page 1 of 1 (latest)

quick eagle
#

hi,
i'm trying to write program using gtkmm, i've somehow maneget to get gtk working on windows but now i'm struggling to add any library (mu own hpp and cpp files ) for now i have flat file structure i want to add mainWindow do main, but i have trouble linking gtk to libs do i need to use target_link_libraries to add gkt to every lib ? If yes is there easy way to do it ?
my cmake :

cmake_minimum_required(VERSION 3.5)
project(HelloWorld)
find_package(PkgConfig)
pkg_check_modules(GTKMM_VARS REQUIRED IMPORTED_TARGET gtkmm-4.0)
pkg_check_modules(GTKMM_LIB REQUIRED IMPORTED_TARGET gtkmm-4.0)
add_executable(HelloWorld main.cpp)
set_property(TARGET HelloWorld PROPERTY CXX_STANDARD 17)
target_link_libraries(HelloWorld PRIVATE PkgConfig::GTKMM_VARS)
target_link_libraries(HelloWorld PRIVATE PkgConfig::GTKMM_LIB)

add_library(mainWindow mainWindow.cpp mainWindow.hpp )

target_link_libraries(HelloWorld PRIVATE mainWindow)

error message:
error C1083: Cannot open include file: 'gtkmm/button.h': No such file or directory

minor vectorBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.