Skip to content

Instantly share code, notes, and snippets.

@marcelhas
Created July 10, 2021 22:15
Show Gist options
  • Save marcelhas/76ac23423ef950059fa78ff6d1e073fe to your computer and use it in GitHub Desktop.
Save marcelhas/76ac23423ef950059fa78ff6d1e073fe to your computer and use it in GitHub Desktop.
Basic GTK4 CMake File
cmake_minimum_required(VERSION 3.19)
project(<project_name> C)
set(CMAKE_C_STANDARD 11)
# Use the package PkgConfig to detect GTK+ headers/library files
FIND_PACKAGE(PkgConfig REQUIRED)
pkg_check_modules (GTK4 REQUIRED gtk4)
# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
INCLUDE_DIRECTORIES(${GTK4_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK4_LIBRARY_DIRS})
# Add other flags to the compiler
ADD_DEFINITIONS(${GTK4_CFLAGS_OTHER})
add_executable(<project_name> <src.c>)
target_link_libraries(<project_name> ${GTK4_LIBRARIES})
@gersomonline
Copy link

You are amazing, thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment