Skip to content

Commit

Permalink
find glib with pkgconfig
Browse files Browse the repository at this point in the history
fall back to old behavior if pkgconfig itself cannot be found or if pkgconfig cannot find glib
  • Loading branch information
nosracd committed Jul 28, 2024
1 parent 6f2f4c9 commit c40e842
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmake/FindGLib2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ endfunction()

###############################################################################

find_package(PkgConfig)

if(${PkgConfig_FOUND})

pkg_check_modules(GLIB glib-2.0)

if(${GLIB_FOUND})
add_library(GLib2::glib UNKNOWN IMPORTED)
set_target_properties(GLib2::glib PROPERTIES
IMPORTED_LOCATION "${pkgcfg_lib_GLIB_glib-2.0}"
INTERFACE_COMPILE_OPTIONS "${GLIB_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${GLIB_INCLUDE_DIRS}"
)
return()
endif()

endif()

_glib2_find_library(GLIB glib)
_glib2_find_include(GLIB glib.h)
_glib2_find_include(GLIBCONFIG glibconfig.h GLIB)
Expand Down

0 comments on commit c40e842

Please sign in to comment.