aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindGLIB2.cmake
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-10-18 19:38:51 +0200
committerAnders Broman <a.broman58@gmail.com>2018-10-18 20:06:16 +0000
commit54286eb09cca14f0931f094c3f4874a2701729a6 (patch)
treeae17020fa671be451cb3acc8a411708034c7c4f2 /cmake/modules/FindGLIB2.cmake
parente6e2137459750cfac0b9ce7bcf259fe8bbccbede (diff)
FindGLIB2.cmake: workaround to make static linking work
When using pkg_search_module(GLIB2 glib-2.0), it will also include transitive dependencies (pcre) in GLIB2_STATIC_LIBRARIES, but it will still lack -pthread (which is in GLIB2_STATIC_LDFLAGS). For simplicity just hardcode these. Change-Id: Ia227f8b56e088c71210a748aeb2dedaba521c090 Reviewed-on: https://code.wireshark.org/review/30252 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cmake/modules/FindGLIB2.cmake')
-rw-r--r--cmake/modules/FindGLIB2.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake
index a86ff01466..c42a1b1490 100644
--- a/cmake/modules/FindGLIB2.cmake
+++ b/cmake/modules/FindGLIB2.cmake
@@ -111,6 +111,11 @@ find_package_handle_standard_args( GLIB2
if( GLIB2_FOUND )
set( GLIB2_LIBRARIES ${GLIB2_LIBRARY} ${GOBJECT_LIBRARY} )
+ # Include transitive dependencies for static linking.
+ if(UNIX AND CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a")
+ find_library(PCRE_LIBRARY pcre)
+ list(APPEND GLIB2_LIBRARIES -pthread ${PCRE_LIBRARY})
+ endif()
set( GLIB2_INCLUDE_DIRS ${GLIB2_MAIN_INCLUDE_DIR} ${GLIB2_INTERNAL_INCLUDE_DIR} )
if ( WIN32 AND GLIB2_FOUND )
set ( GLIB2_DLL_DIR "${GLIB2_HINTS}/bin"