You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.2 KiB

  1. # From https://code.google.com/p/libcitygml/source/browse/trunk/CMakeModules/FindXerces.cmake?r=95
  2. # - Try to find Xerces-C
  3. # Once done this will define
  4. #
  5. # XERCESC_FOUND - system has Xerces-C
  6. # XERCESC_INCLUDE - the Xerces-C include directory
  7. # XERCESC_LIBRARY - Link these to use Xerces-C
  8. # XERCESC_VERSION - Xerces-C found version
  9. IF (XERCESC_INCLUDE AND XERCESC_LIBRARY)
  10. # in cache already
  11. SET(XERCESC_FIND_QUIETLY TRUE)
  12. ENDIF (XERCESC_INCLUDE AND XERCESC_LIBRARY)
  13. FIND_PATH(XERCESC_INCLUDE NAMES xercesc/util/XercesVersion.hpp
  14. PATHS
  15. $ENV{XERCESC_INCLUDE_DIR}
  16. ${XERCESC_INCLUDE_DIR}
  17. /usr/local/include
  18. /usr/include
  19. )
  20. IF (XERCESC_STATIC)
  21. FIND_LIBRARY(XERCESC_LIBRARIES NAMES xerces-c_static_3 xerces-c-3.1 xerces-c
  22. PATHS
  23. $ENV{XERCESC_LIBRARY_DIR}
  24. ${XERCESC_LIBRARY_DIR}
  25. /usr/lib
  26. /usr/local/lib
  27. )
  28. FIND_LIBRARY(XERCESC_LIBRARIES_DEBUG NAMES xerces-c_static_3D xerces-c-3.1D
  29. PATHS
  30. $ENV{XERCESC_LIBRARY_DIR}
  31. ${XERCESC_LIBRARY_DIR}
  32. /usr/lib
  33. /usr/local/lib
  34. )
  35. ADD_DEFINITIONS( -DXERCES_STATIC_LIBRARY )
  36. ELSE (XERCESC_STATIC)
  37. FIND_LIBRARY(XERCESC_LIBRARY NAMES xerces-c_3
  38. PATHS
  39. $ENV{XERCESC_LIBRARY_DIR}
  40. ${XERCESC_LIBRARY_DIR}
  41. )
  42. FIND_LIBRARY(XERCESC_LIBRARIES_DEBUG NAMES xerces-c_3D
  43. PATHS
  44. $ENV{XERCESC_LIBRARY_DIR}
  45. ${XERCESC_LIBRARY_DIR}
  46. )
  47. ENDIF (XERCESC_STATIC)
  48. IF (XERCESC_INCLUDE AND XERCESC_LIBRARIES)
  49. SET(XERCESC_FOUND TRUE)
  50. ELSE (XERCESC_INCLUDE AND XERCESC_LIBRARIES)
  51. SET(XERCESC_FOUND FALSE)
  52. ENDIF (XERCESC_INCLUDE AND XERCESC_LIBRARIES)
  53. IF(XERCESC_FOUND)
  54. FIND_PATH(XERCESC_XVERHPPPATH NAMES XercesVersion.hpp PATHS
  55. ${XERCESC_INCLUDE}
  56. PATH_SUFFIXES xercesc/util)
  57. IF ( ${XERCESC_XVERHPPPATH} STREQUAL XERCESC_XVERHPPPATH-NOTFOUND )
  58. SET(XERCES_VERSION "0")
  59. ELSE( ${XERCESC_XVERHPPPATH} STREQUAL XERCESC_XVERHPPPATH-NOTFOUND )
  60. FILE(READ ${XERCESC_XVERHPPPATH}/XercesVersion.hpp XVERHPP)
  61. STRING(REGEX MATCHALL "\n *#define XERCES_VERSION_MAJOR +[0-9]+" XVERMAJ
  62. ${XVERHPP})
  63. STRING(REGEX MATCH "\n *#define XERCES_VERSION_MINOR +[0-9]+" XVERMIN
  64. ${XVERHPP})
  65. STRING(REGEX MATCH "\n *#define XERCES_VERSION_REVISION +[0-9]+" XVERREV
  66. ${XVERHPP})
  67. STRING(REGEX REPLACE "\n *#define XERCES_VERSION_MAJOR +" ""
  68. XVERMAJ ${XVERMAJ})
  69. STRING(REGEX REPLACE "\n *#define XERCES_VERSION_MINOR +" ""
  70. XVERMIN ${XVERMIN})
  71. STRING(REGEX REPLACE "\n *#define XERCES_VERSION_REVISION +" ""
  72. XVERREV ${XVERREV})
  73. SET(XERCESC_VERSION ${XVERMAJ}.${XVERMIN}.${XVERREV})
  74. ENDIF ( ${XERCESC_XVERHPPPATH} STREQUAL XERCESC_XVERHPPPATH-NOTFOUND )
  75. IF(NOT XERCESC_FIND_QUIETLY)
  76. MESSAGE(STATUS "Found Xerces-C: ${XERCESC_LIBRARY}")
  77. MESSAGE(STATUS " : ${XERCESC_INCLUDE}")
  78. MESSAGE(STATUS " Version: ${XERCESC_VERSION}")
  79. ENDIF(NOT XERCESC_FIND_QUIETLY)
  80. ENDIF(XERCESC_FOUND)
  81. MARK_AS_ADVANCED(XERCESC_INCLUDE XERCESC_LIBRARIES)