summaryrefslogtreecommitdiff
path: root/cmake/modules/FindXPM.cmake
blob: e03f3a6c08469dd5de1f029bf46fcde4927b383b (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
57
# - Find the native PNG includes and library
#

# This module defines
#  XPM_INCLUDE_DIR, where to find png.h, etc.
#  XPM_LIBRARIES, the libraries to link against to use PNG.
#  XPM_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
#  XPM_FOUND, If false, do not try to use PNG.
# also defined, but not for general use are
#  XPM_LIBRARY, where to find the PNG library.
# None of the above will be defined unles zlib can be found.
# PNG depends on Zlib
#
# Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.


INCLUDE(FindZLIB)

SET(XPM_FOUND "NO")

FIND_PATH(XPM_XPM_INCLUDE_DIR xpm.h
/usr/local/include/X11
/usr/include/X11
)

SET(XPM_NAMES ${XPM_NAMES} Xpm libXpm)
FIND_LIBRARY(XPM_LIBRARY
 NAMES ${XPM_NAMES}
 PATHS /usr/lib64 /usr/lib /usr/local/lib
)

IF (XPM_LIBRARY AND XPM_XPM_INCLUDE_DIR)
	SET(XPM_INCLUDE_DIR ${XPM_XPM_INCLUDE_DIR})
	SET(XPM_LIBRARIES ${XPM_LIBRARY})
	SET(XPM_FOUND "YES")

	IF (CYGWIN)
	  IF(BUILD_SHARED_LIBS)
		  # No need to define XPM_USE_DLL here, because it's default for Cygwin.
	  ELSE(BUILD_SHARED_LIBS)
		 SET (XPM_DEFINITIONS -DXPM_STATIC)
	  ENDIF(BUILD_SHARED_LIBS)
	ENDIF (CYGWIN)
ENDIF (XPM_LIBRARY AND XPM_XPM_INCLUDE_DIR)

IF (XPM_FOUND)
  IF (NOT XPM_FIND_QUIETLY)
    MESSAGE(STATUS "Found XPM: ${XPM_LIBRARY}")
  ENDIF (NOT XPM_FIND_QUIETLY)
ELSE (XPM_FOUND)
  IF (XPM_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could not find XPM library")
  ENDIF (XPM_FIND_REQUIRED)
ENDIF (XPM_FOUND)

MARK_AS_ADVANCED(XPM_XPM_INCLUDE_DIR XPM_LIBRARY )