aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2021-06-10 11:09:28 -0700
committerAndersBroman <a.broman58@gmail.com>2021-06-11 11:22:11 +0000
commitb86ec10ca4e85d40e8103a0f7779b27ab65e4ccf (patch)
tree341456c97e77cc4988492ffa711a93dbb219998d /cmake/modules
parentdc7f0b88bba0c703d9c802b153e145dc6b3dc549 (diff)
CMake: Fixup our glibconfig.h discovery.
On Windows, search for glibconfig.h in the vcpkg lib directory. Search for it in the directory that contains libglib-2.0 on other platforms. Avoid a side effect that caused us to search in `/lib` on non-Windows platforms. Don't add GLIB2_LIBRARY to the search path -- that contains the path to a file, not a directory.
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindGLIB2.cmake17
1 files changed, 10 insertions, 7 deletions
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake
index ad3cb4bee8..7b97d339f7 100644
--- a/cmake/modules/FindGLIB2.cmake
+++ b/cmake/modules/FindGLIB2.cmake
@@ -65,22 +65,25 @@ FindWSLibrary( GLIB2_LIBRARY
/usr/lib
)
-# search the glibconfig.h include dir under the same root where the library is found
-get_filename_component( glib2LibDir "${GLIB2_LIBRARY}" PATH)
+if (WIN32)
+ # In the Windows vcpkg port glibconfig.h is in
+ # installed/$ARCH-windows/lib/glib-2.0/include.
+ set( glib2LibDir "${GLIB2_HINTS}/lib" )
+else()
+ # On UNIX and UNIX-like platforms, the glibconfig.h include dir
+ # should be in glib-2.0/include in the library directory.
+ get_filename_component( glib2LibDir "${GLIB2_LIBRARY}" PATH)
+endif()
find_path( GLIB2_INTERNAL_INCLUDE_DIR
NAMES
glibconfig.h
HINTS
- "${GLIB2_INCLUDEDIR}"
- "${GLIB2_HINTS}/lib"
"${glib2LibDir}"
+ "${GLIB2_INCLUDEDIR}"
${CMAKE_SYSTEM_LIBRARY_PATH}
PATH_SUFFIXES
glib-2.0/include
- PATHS
- ${GLIB2_LIBRARY}
-
)
if(PC_GLIB2_VERSION)