summaryrefslogtreecommitdiffstats
path: root/CMakeScripts/Modules/FindPotrace.cmake
blob: 9ab995278124e7247829d3e85e46b79a352568d6 (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
58
59
60
61
62
#  POTRACE_FOUND - system has Potrace
#  POTRACE_INCLUDE_DIRS - the Potrace include directory
#  POTRACE_LIBRARIES - The libraries needed to use Potrace

IF (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS)
   # in cache already
   SET(POTRACE_FOUND TRUE)
ELSE (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS)
   FIND_PATH (POTRACE_INCLUDE_DIR
      NAMES
         potracelib.h
      PATHS
         /usr/include
         /usr/local/include
	 $ENV{DEVLIBS_PATH}/include
      PATH_SUFFIXES
         potrace
   )

   FIND_LIBRARY (POTRACE_LIBRARY
      NAMES
        potrace
        libpotrace
      PATHS
         /usr/lib
         /usr/local/lib
         $ENV{DEVLIBS_PATH}/lib
   )

   if (POTRACE_LIBRARY)
      set (POTRACE_FOUND TRUE)
   endif (POTRACE_LIBRARY)

   set (POTRACE_INCLUDE_DIRS
      ${POTRACE_INCLUDE_DIR}
   )

   if (POTRACE_FOUND)
      set(POTRACE_LIBRARIES
        ${POTRACE_LIBRARIES}
        ${POTRACE_LIBRARY}
      )
   endif (POTRACE_FOUND)

   if (POTRACE_INCLUDE_DIRS AND POTRACE_LIBRARIES)
      set(POTRACE_FOUND TRUE)
   endif (POTRACE_INCLUDE_DIRS AND POTRACE_LIBRARIES)

   if (POTRACE_FOUND)
      if (NOT Potrace_FIND_QUIETLY)
         message(STATUS "Found Potrace: ${POTRACE_LIBRARIES}")
      endif (NOT Potrace_FIND_QUIETLY)
   else (POTRACE_FOUND)
      if (Potrace_FIND_REQUIRED)
	      message(FATAL_ERROR "Could not find potrace")
      endif (Potrace_FIND_REQUIRED)
   endif (POTRACE_FOUND)

   # show the POTRACE_INCLUDE_DIRS and POTRACE_LIBRARIES variables only in the advanced view
   MARK_AS_ADVANCED(POTRACE_INCLUDE_DIRS POTRACE_LIBRARIES)

endif (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS)