summaryrefslogtreecommitdiffstats
path: root/CMakeScripts/Modules/FindLibCDR.cmake
blob: 57a04807eb8fa50f6d56f61ccc980e84d08a77d8 (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
49
50
51
52
53
54
55
56
# - Try to find LibCDR
# Once done this will define
#
#  LIBCDR_FOUND - system has LibCDR
#  LIBCDR_INCLUDE_DIRS - the LibCDR include directory
#  LIBCDR_LIBRARIES - Link these to use LibCDR
#  LIBCDR_DEFINITIONS - Compiler switches required for using LibCDR
#
#  Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
#  Copyright (c) 2015 su_v <suv-sf@users.sf.net>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

include(${CMAKE_CURRENT_LIST_DIR}/../HelperMacros.cmake)

if (LIBCDR_LIBRARIES AND LIBCDR_INCLUDE_DIRS)
	# in cache already
	set(LIBCDR_FOUND TRUE)
else (LIBCDR_LIBRARIES AND LIBCDR_INCLUDE_DIRS)
	# use pkg-config to get the directories and then use these values
	# in the FIND_PATH() and FIND_LIBRARY() calls
	find_package(PkgConfig)
	if (PKG_CONFIG_FOUND)
		INKSCAPE_PKG_CONFIG_FIND(LIBCDR-0.1 libcdr-0.1 0 libcdr/libcdr.h libcdr-0.1 cdr-0.1)
		if (LIBCDR-0.1_FOUND)
			find_package(LibRevenge)
			if (LIBREVENGE_FOUND)
				list(APPEND LIBCDR_INCLUDE_DIRS ${LIBCDR-0.1_INCLUDE_DIRS})
				list(APPEND LIBCDR_LIBRARIES    ${LIBCDR-0.1_LIBRARIES})
				list(APPEND LIBCDR_INCLUDE_DIRS ${LIBREVENGE_INCLUDE_DIRS})
				list(APPEND LIBCDR_LIBRARIES    ${LIBREVENGE_LIBRARIES})
				set(LIBCDR01_FOUND TRUE)
			endif (LIBREVENGE_FOUND)
		else()
			INKSCAPE_PKG_CONFIG_FIND(LIBCDR-0.0 libcdr-0.0 0 libcdr/libcdr.h libcdr-0.0 cdr-0.0)
			INKSCAPE_PKG_CONFIG_FIND(LIBWPD-0.9 libwpd-0.9 0 libwpd/libwpd.h libwpd-0.9 wpd-0.9)
			INKSCAPE_PKG_CONFIG_FIND(LIBWPD-STREAM-0.9 libwpd-stream-0.9 0 libwpd/libwpd.h libwpd-0.9 wpd-stream-0.9)
			if (LIBCDR-0.0_FOUND AND LIBWPD-STREAM-0.9_FOUND AND LIBWPD-0.9_FOUND)
				list(APPEND LIBCDR_INCLUDE_DIRS ${LIBCDR-0.0_INCLUDE_DIRS})
				list(APPEND LIBCDR_LIBRARIES    ${LIBCDR-0.0_LIBRARIES})
				list(APPEND LIBCDR_INCLUDE_DIRS ${LIBWPD-0.9_INCLUDE_DIRS})
				list(APPEND LIBCDR_LIBRARIES    ${LIBWPD-0.9_LIBRARIES})
				list(APPEND LIBCDR_INCLUDE_DIRS ${LIBWPD-STREAM-0.9_INCLUDE_DIRS})
				list(APPEND LIBCDR_LIBRARIES    ${LIBWPD-STREAM-0.9_LIBRARIES})
				set(LIBCDR00_FOUND TRUE)
			endif (LIBCDR-0.0_FOUND AND LIBWPD-STREAM-0.9_FOUND AND LIBWPD-0.9_FOUND)
		endif (LIBCDR-0.1_FOUND)
		if (LIBCDR-0.1_FOUND OR LIBCDR-0.0_FOUND)
			set(LIBCDR_FOUND TRUE)
		endif (LIBCDR-0.1_FOUND OR LIBCDR-0.0_FOUND)
	endif (PKG_CONFIG_FOUND)
endif (LIBCDR_LIBRARIES AND LIBCDR_INCLUDE_DIRS)