summaryrefslogtreecommitdiff
path: root/CMake/FindZlib.cmake
blob: 3ad5b6c911ce8af65c7a83fc9fd9b13398760725 (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
# Finds zlib.
#
# This module defines:
# zlib_INCLUDE_DIR_ZIP
# zlib_INCLUDE_DIR_ZIPCONF
# zlib_LIBRARY
#
# There is no default installation for zlib on Windows so a
# XTrackCAD specific directory tree is assumed
#

if(WIN32)
  # Folders for x86/x64
  if (WIN64)
    find_path( ZLIB_INCLUDE_DIR zlib.h
      PATHS
      $ENV{XTCEXTERNALROOT}/x64/zlib
      DOC "The directory where zlib.h resides")
    find_library( ZLIB_LIBRARY
      NAMES zlib Zlib
      PATHS
      $ENV{XTCEXTERNALROOT}/x64/zlib
      DOC "The zlib library")
    find_file( ZLIB_SHAREDLIB
      NAMES zlib.dll Zlib.dll
      PATHS
      $ENV{XTCEXTERNALROOT}/x64/zlib)
  else (WIN64)
    find_path( ZLIB_INCLUDE_DIR zlib.h
      PATHS
      $ENV{XTCEXTERNALROOT}/x86/zlib
      DOC "The directory where zlib.h resides")
    find_library( ZLIB_LIBRARY
      NAMES zlib Zlib
      PATHS
      $ENV{XTCEXTERNALROOT}/x86/zlib
      DOC "The zlib library")
    find_file( ZLIB_SHAREDLIB
      NAMES zlib.dll Zlib.dll
      PATHS
      $ENV{XTCEXTERNALROOT}/x86/zlib)
  endif (WIN64)
else(WIN32)
  find_package(PkgConfig)
  pkg_check_modules(PC_ZLIB QUIET zlib)

  find_path(ZLIB_INCLUDE_DIR
      NAMES zlib.h
      HINTS ${PC_ZLIB_INCLUDE_DIRS})

  find_library(ZLIB_LIBRARY
  	NAMES z)
endif(WIN32)

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
  ZLIB DEFAULT_MSG
  ZLIB_LIBRARY ZLIB_INCLUDE_DIR)

mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)