I'm learning GTK4 and I managed to build an executable from CLion in the past, but it seems that since the last SW update (2022.2.3) it can't find the GTK4 package, and I'm getting this output:
====================[ Build | c_gtk_sandbox | Debug ]===========================
"/Users/madin/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/222.4167.35/CLion.app/Contents/bin/cmake/mac/bin/cmake" --build /Users/madin/Documents/GitRepos/c_gtk_sandbox/cmake-build-debug --target c_gtk_sandbox -j 6
[0/1] Re-running CMake...
-- Checking for module 'gtk4'
-- No package 'gtk4' found
CMake Error at /Users/madin/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/222.4167.35/CLion.app/Contents/bin/cmake/mac/share/cmake-3.23/Modules/FindPkgConfig.cmake:605 (message):
A required package was not found
Call Stack (most recent call first):
/Users/madin/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/222.4167.35/CLion.app/Contents/bin/cmake/mac/share/cmake-3.23/Modules/FindPkgConfig.cmake:827 (_pkg_check_modules_internal)
CMakeLists.txt:18 (pkg_check_modules)
-- Configuring incomplete, errors occurred!
See also "/Users/madin/Documents/GitRepos/c_gtk_sandbox/cmake-build-debug/CMakeFiles/CMakeOutput.log".
FAILED: build.ninja
"/Users/madin/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/222.4167.35/CLion.app/Contents/bin/cmake/mac/bin/cmake" --regenerate-during-build -S/Users/madin/Documents/GitRepos/c_gtk_sandbox -B/Users/madin/Documents/GitRepos/c_gtk_sandbox/cmake-build-debug
ninja: error: rebuilding 'build.ninja': subcommand failed
That's the content of the project's CMakeLists.txt file:
cmake_minimum_required(VERSION 3.22)
set(CMAKE_C_STANDARD 99)
project(c_gtk_sandbox C)
set(SOURCE_FILES main.c)
# use this to find the brew package.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK4 REQUIRED gtk4)
# Available variables: GTKMM_INCLUDE_DIRS, GTKMM_LIBRARY_DIRS and GTKMM_LIBRARIES
include_directories(${GTK4_INCLUDE_DIRS})
link_directories(${GTK4_LIBRARY_DIRS})
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${GTK4_LIBRARIES})
# Been warned that order in cmake matters.
When running:
brew list | grep gtk4
gtk4 appears, but it doesn't appear when running:
pkg-config --list-all | grep gtk4
I'm using MacBook Air M1