Replies: 2 comments
-
|
Cmkr purposefully does not support [variables]
CMAKE_MODULE_PATH = "cmake"
# Looks for cmake/FindGTK4.cmake
[find-package.GTK4]
[target.mygui]
type = "executable"
sources = ["src/main.cpp"]
link-libraries = ["GTK4::gtk4"]You will then need to write # FindGTK4.cmake - Find GTK4 package using pkg-config and create imported targets.
# Check if GTK4 is already found
if(TARGET GTK4::gtk4)
set(GTK4_FOUND ON)
return()
endif()
# Find the GTK4 package using pkg-config
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK4 REQUIRED gtk4)
# Create the imported target
add_library(GTK4::gtk4 INTERFACE IMPORTED)
# Set the include directories
set_target_properties(GTK4::gtk4 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GTK4_INCLUDE_DIRS}"
INTERFACE_COMPILE_OPTIONS "${GTK4_CFLAGS_OTHER}"
INTERFACE_LINK_LIBRARIES "${GTK4_LIBRARIES}"
)The documentation for |
Beta Was this translation helpful? Give feedback.
-
|
Following up, here is an example project that does this: https://github.com/mrexodia/invivo-cbct
if(TARGET JasPer::jasper)
set(JasPer_FOUND ON)
return()
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(JasPer REQUIRED jasper)
add_library(JasPer::jasper INTERFACE IMPORTED)
set_target_properties(JasPer::jasper PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JasPer_INCLUDE_DIRS}"
INTERFACE_COMPILE_OPTIONS "${JasPer_CFLAGS_OTHER}"
INTERFACE_LINK_LIBRARIES "${JasPer_LINK_LIBRARIES}"
)And the relevant part of [variables]
CMAKE_MODULE_PATH = "cmake"
[project]
name = "invivo-cbct"
version = "1.0.0"
languages = ["C"]
[vcpkg]
version = "2025.06.13"
packages = ["sdl2", "jasper", "pthreads", "stb", "pkgconf"]
overlay = "vcpkg-overlay"
[find-package.SDL2]
required = true
config = true
[find-package.JasPer]
required = true
[find-package.PThreads4W]
required = true
[find-package.Stb]
required = trueImportant to add |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
in the gtk compilation tutorial it uses gcc together with
pkg-config, but it seems thatcmkrdoes not support this module: https://cmake.org/cmake/help/latest/module/FindPkgConfig.htmlthe command would be this
gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs gtk4 ), how to translate this to cmkr?Beta Was this translation helpful? Give feedback.
All reactions