Reverting my windows build fix because it breaks the bug fix committed in r40995
[blender.git] / build_files / cmake / Modules / FindXML2.cmake
1 # - Find XML2 library
2 # Find the native XML2 includes and library
3 # This module defines
4 #  XML2_INCLUDE_DIRS, where to find xml2.h, Set when
5 #                     XML2_INCLUDE_DIR is found.
6 #  XML2_LIBRARIES, libraries to link against to use XML2.
7 #  XML2_ROOT_DIR, The base directory to search for XML2.
8 #                 This can also be an environment variable.
9 #  XML2_FOUND, If false, do not try to use XML2.
10 #
11 # also defined, but not for general use are
12 #  XML2_LIBRARY, where to find the XML2 library.
13
14 #=============================================================================
15 # Copyright 2011 Blender Foundation.
16 #
17 # Distributed under the OSI-approved BSD License (the "License");
18 # see accompanying file Copyright.txt for details.
19 #
20 # This software is distributed WITHOUT ANY WARRANTY; without even the
21 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 # See the License for more information.
23 #=============================================================================
24
25 # If XML2_ROOT_DIR was defined in the environment, use it.
26 IF(NOT XML2_ROOT_DIR AND NOT $ENV{XML2_ROOT_DIR} STREQUAL "")
27   SET(XML2_ROOT_DIR $ENV{XML2_ROOT_DIR})
28 ENDIF()
29
30 SET(_xml2_SEARCH_DIRS
31   ${XML2_ROOT_DIR}
32   /usr/local
33   /sw # Fink
34   /opt/local # DarwinPorts
35   /opt/csw # Blastwave
36 )
37
38 FIND_PATH(XML2_INCLUDE_DIR libxml2/libxml/xpath.h
39   HINTS
40     ${_xml2_SEARCH_DIRS}
41   PATH_SUFFIXES
42     include
43 )
44
45 FIND_LIBRARY(XML2_LIBRARY
46   NAMES
47     xml2
48   HINTS
49     ${_xml2_SEARCH_DIRS}
50   PATH_SUFFIXES
51     lib64 lib
52   )
53
54 # handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if 
55 # all listed variables are TRUE
56 INCLUDE(FindPackageHandleStandardArgs)
57 FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
58     XML2_LIBRARY XML2_INCLUDE_DIR)
59
60 IF(XML2_FOUND)
61   SET(XML2_LIBRARIES ${XML2_LIBRARY})
62   SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR})
63 ENDIF(XML2_FOUND)
64
65 MARK_AS_ADVANCED(
66   XML2_INCLUDE_DIR
67   XML2_LIBRARY
68 )