nixpkgs/pkgs/applications/editors/jetbrains/patches/libdbm-headers.patch
2023-12-03 19:32:27 +00:00

53 lines
1.7 KiB
Diff

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
project(dbm)
include(CheckCXXSourceCompiles)
-include (CheckCXXCompilerFlag)
+include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fvisibility=hidden __DBUSMENU_HAVE_GCC_VISIBILITY)
if (__DBUSMENU_HAVE_GCC_VISIBILITY AND NOT WIN32)
@@ -19,27 +19,13 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif (__DBUSMENU_HAVE_W_ALL)
-
-find_library(LIB_GLIB NAMES glib libglib libglib-2.0.so.0)
-MESSAGE("LIB_GLIB: " ${LIB_GLIB})
-
-find_library(LIB_GIO NAMES libgio-2.0.so.0)
-MESSAGE("LIB_GIO: " ${LIB_GIO})
-
-find_library(LIB_GOBJ NAMES libgobject-2.0.so.0)
-MESSAGE("LIB_GOBJ: " ${LIB_GOBJ})
+find_package(PkgConfig REQUIRED)
+pkg_search_module(GLIB REQUIRED glib-2.0)
+pkg_search_module(LIBDBUSMENU REQUIRED dbusmenu-glib-0.4)
# use patched library, you may build it from https://github.com/JetBrains/libdbusmenu
set(LIB_DBUSMENU "${PROJECT_SOURCE_DIR}/libdbusmenu-glib.a")
-set(GLIB_INCLUDE_DIRS /usr/include/glib-2.0 /usr/lib64/glib-2.0/include)
-set(DBUSMENU_GLIB_INCLUDE_DIRS /usr/include/libdbusmenu-glib-0.4)
-
-include_directories(
- ${GLIB_INCLUDE_DIRS}
- ${DBUSMENU_GLIB_INCLUDE_DIRS}
-)
-
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
@@ -47,7 +33,8 @@
set(SOURCE_FILES DbusMenuWrapper.c)
add_library(dbm SHARED ${SOURCE_FILES})
-target_link_libraries(dbm ${LIB_GLIB} ${LIB_GIO} ${LIB_DBUSMENU} ${LIB_GOBJ})
+target_link_libraries(dbm ${LIB_DBUSMENU} ${GLIB_LDFLAGS})
+include_directories(dbm ${GLIB_INCLUDE_DIRS} ${LIBDBUSMENU_INCLUDE_DIRS})
if (TESTS_ENABLED)
find_library(LIB_GTK NAMES libgtk-3.so)