summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindGTHREAD2.cmake
blob: 172ee5517e363767bd3dad755c3cdfb83041bbca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# - Try to find GThread2
# Find GThread headers, libraries and the answer to all questions.
#
#  GTHREAD2_FOUND               True if GTHREAD2 was found
#  GTHREAD2_INCLUDE_DIRS        Location of GTHREAD2 headers
#  GTHREAD2_LIBRARIES           List of libraries to use GTHREAD2
#

include(FindWSWinLibs)
FindWSWinLibs("vcpkg-export-*" "GTHREAD2_HINTS")

if(NOT USE_REPOSITORY)
	find_package(PkgConfig QUIET)
	pkg_check_modules(PC_GTHREAD2 gthread-2.0)
endif()

find_path(GTHREAD2_INCLUDE_DIR
	NAMES
		glib/gthread.h
	PATH_SUFFIXES
		glib-2.0
	HINTS
		${PC_GTHREAD2_INCLUDE_DIRS}
		"${GTHREAD2_HINTS}/include"
)
include(FindWSLibrary)
FindWSLibrary(GTHREAD2_LIBRARY
	NAMES
		gthread-2.0 gthread
	HINTS
		${PC_GTHREAD2_LIBRARY_DIRS}
	WIN32_HINTS
		${GTHREAD2_HINTS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTHREAD2 DEFAULT_MSG GTHREAD2_LIBRARY GTHREAD2_INCLUDE_DIR)

if(GTHREAD2_FOUND)
	set(GTHREAD2_INCLUDE_DIRS ${GTHREAD2_INCLUDE_DIR})
	set(GTHREAD2_LIBRARIES ${GTHREAD2_LIBRARY})
else()
	set(GTHREAD2_INCLUDE_DIRS)
	set(GTHREAD2_LIBRARIES)
endif()

mark_as_advanced(GTHREAD2_LIBRARIES GTHREAD2_INCLUDE_DIRS)