summary refs log tree commit diff
path: root/pkgs/desktops/kde-4.5/artwork/FindXscreensaver.cmake
blob: caa5ddd925499c42b1eca3177c8603da000f9ae4 (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#Macro to find xscreensaver directory

# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if (NOT XSCREENSAVER_FOUND)
  FIND_PATH(XSCREENSAVER_DIR deco
    HINTS
      ${KDE4_INCLUDE_DIR}
	PATHS
      /usr
      /usr/local
      /opt/local
      /usr/X11R6
      /opt/kde
      /opt/kde3
      /usr/kde
      /usr/local/kde
      /usr/local/xscreensaver
      /usr/openwin/lib/xscreensaver
      /etc
	PATH_SUFFIXES
      lib${LIB_SUFFIX}/xscreensaver
      lib/xscreensaver
	  lib${LIB_SUFFIX}/misc/xscreensaver
	  lib/misc/xscreensaver
	  libexec/xscreensaver
	  bin/xscreensaver-hacks
	  hacks)
  message(XSCREENSAVER_DIR ${XSCREENSAVER_DIR})

  set(XSCREENSAVER_CONFIG_DIR)
  FIND_PATH(XSCREENSAVER_CONFIG_DECO config/deco.xml
    PATHS
    ${KDE4_INCLUDE_DIR}
    /usr/
    /usr/local/
    /opt/local/
    /usr/X11R6/
    /opt/kde/
    /opt/kde3/
    /usr/kde/
    /usr/local/kde/
    /usr/openwin/lib/xscreensaver/
    /etc/
    PATH_SUFFIXES xscreensaver share/xscreensaver
  )
  #MESSAGE(STATUS "XSCREENSAVER_CONFIG_DIR :<${XSCREENSAVER_CONFIG_DIR}>")

  if(XSCREENSAVER_CONFIG_DECO)
	set(XSCREENSAVER_CONFIG_DIR "${XSCREENSAVER_CONFIG_DECO}/config/")
	#MESSAGE(STATUS "XSCREENSAVER_CONFIG_DIR <${XSCREENSAVER_CONFIG_DIR}>")
  endif(XSCREENSAVER_CONFIG_DECO)


  # Try and locate XScreenSaver config when path doesn't include config
  if(NOT XSCREENSAVER_CONFIG_DIR)
    FIND_PATH(XSCREENSAVER_CONFIG_DIR deco.xml
      /etc/xscreensaver
      )
  endif(NOT XSCREENSAVER_CONFIG_DIR)
endif(NOT XSCREENSAVER_FOUND)

#MESSAGE(STATUS "XSCREENSAVER_CONFIG_DIR :<${XSCREENSAVER_CONFIG_DIR}>")
#MESSAGE(STATUS "XSCREENSAVER_DIR :<${XSCREENSAVER_DIR}>")

# Need to fix hack
if(XSCREENSAVER_DIR AND XSCREENSAVER_CONFIG_DIR)
	set(XSCREENSAVER_FOUND TRUE)
endif(XSCREENSAVER_DIR AND XSCREENSAVER_CONFIG_DIR)

if (XSCREENSAVER_FOUND)
  if (NOT Xscreensaver_FIND_QUIETLY)
    message(STATUS "Found XSCREENSAVER_CONFIG_DIR <${XSCREENSAVER_CONFIG_DIR}>")
  endif (NOT Xscreensaver_FIND_QUIETLY)
else (XSCREENSAVER_FOUND)
  if (Xscreensaver_FIND_REQUIRED)
    message(FATAL_ERROR "XScreenSaver not found")
  endif (Xscreensaver_FIND_REQUIRED)
endif (XSCREENSAVER_FOUND)


MARK_AS_ADVANCED(XSCREENSAVER_DIR XSCREENSAVER_CONFIG_DIR)