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.

103 lines
3.5 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. OPTION(XERCESC_STATIC "Set to ON to link your project with static library (instead of DLL)." ON)
  14. IF (NOT ${XERCESC_WAS_STATIC} STREQUAL ${XERCESC_STATIC})
  15. UNSET(XERCESC_LIBRARY CACHE)
  16. UNSET(XERCESC_LIBRARY_DEBUG CACHE)
  17. ENDIF (NOT ${XERCESC_WAS_STATIC} STREQUAL ${XERCESC_STATIC})
  18. SET(XERCESC_WAS_STATIC ${XERCESC_STATIC} CACHE INTERNAL "" )
  19. FIND_PATH(XERCESC_INCLUDE NAMES xercesc/util/XercesVersion.hpp
  20. PATHS
  21. $ENV{XERCESC_INCLUDE_DIR}
  22. ${XERCESC_INCLUDE_DIR}
  23. /usr/local/include
  24. /usr/include
  25. )
  26. IF (XERCESC_STATIC)
  27. FIND_LIBRARY(XERCESC_LIBRARIES NAMES xerces-c_static_3 xerces-c-3.1 xerces-c
  28. PATHS
  29. $ENV{XERCESC_LIBRARY_DIR}
  30. ${XERCESC_LIBRARY_DIR}
  31. /usr/lib
  32. /usr/local/lib
  33. )
  34. FIND_LIBRARY(XERCESC_LIBRARIES_DEBUG NAMES xerces-c_static_3D xerces-c-3.1D
  35. PATHS
  36. $ENV{XERCESC_LIBRARY_DIR}
  37. ${XERCESC_LIBRARY_DIR}
  38. /usr/lib
  39. /usr/local/lib
  40. )
  41. ADD_DEFINITIONS( -DXERCES_STATIC_LIBRARY )
  42. ELSE (XERCESC_STATIC)
  43. FIND_LIBRARY(XERCESC_LIBRARY NAMES xerces-c_3
  44. PATHS
  45. $ENV{XERCESC_LIBRARY_DIR}
  46. ${XERCESC_LIBRARY_DIR}
  47. )
  48. FIND_LIBRARY(XERCESC_LIBRARIES_DEBUG NAMES xerces-c_3D
  49. PATHS
  50. $ENV{XERCESC_LIBRARY_DIR}
  51. ${XERCESC_LIBRARY_DIR}
  52. )
  53. ENDIF (XERCESC_STATIC)
  54. IF (XERCESC_INCLUDE AND XERCESC_LIBRARIES)
  55. SET(XERCESC_FOUND TRUE)
  56. ELSE (XERCESC_INCLUDE AND XERCESC_LIBRARIES)
  57. SET(XERCESC_FOUND FALSE)
  58. ENDIF (XERCESC_INCLUDE AND XERCESC_LIBRARIES)
  59. IF(XERCESC_FOUND)
  60. FIND_PATH(XERCESC_XVERHPPPATH NAMES XercesVersion.hpp PATHS
  61. ${XERCESC_INCLUDE}
  62. PATH_SUFFIXES xercesc/util)
  63. IF ( ${XERCESC_XVERHPPPATH} STREQUAL XERCESC_XVERHPPPATH-NOTFOUND )
  64. SET(XERCES_VERSION "0")
  65. ELSE( ${XERCESC_XVERHPPPATH} STREQUAL XERCESC_XVERHPPPATH-NOTFOUND )
  66. FILE(READ ${XERCESC_XVERHPPPATH}/XercesVersion.hpp XVERHPP)
  67. STRING(REGEX MATCHALL "\n *#define XERCES_VERSION_MAJOR +[0-9]+" XVERMAJ
  68. ${XVERHPP})
  69. STRING(REGEX MATCH "\n *#define XERCES_VERSION_MINOR +[0-9]+" XVERMIN
  70. ${XVERHPP})
  71. STRING(REGEX MATCH "\n *#define XERCES_VERSION_REVISION +[0-9]+" XVERREV
  72. ${XVERHPP})
  73. STRING(REGEX REPLACE "\n *#define XERCES_VERSION_MAJOR +" ""
  74. XVERMAJ ${XVERMAJ})
  75. STRING(REGEX REPLACE "\n *#define XERCES_VERSION_MINOR +" ""
  76. XVERMIN ${XVERMIN})
  77. STRING(REGEX REPLACE "\n *#define XERCES_VERSION_REVISION +" ""
  78. XVERREV ${XVERREV})
  79. SET(XERCESC_VERSION ${XVERMAJ}.${XVERMIN}.${XVERREV})
  80. ENDIF ( ${XERCESC_XVERHPPPATH} STREQUAL XERCESC_XVERHPPPATH-NOTFOUND )
  81. IF(NOT XERCESC_FIND_QUIETLY)
  82. MESSAGE(STATUS "Found Xerces-C: ${XERCESC_LIBRARY}")
  83. MESSAGE(STATUS " : ${XERCESC_INCLUDE}")
  84. MESSAGE(STATUS " Version: ${XERCESC_VERSION}")
  85. ENDIF(NOT XERCESC_FIND_QUIETLY)
  86. ENDIF(XERCESC_FOUND)
  87. MARK_AS_ADVANCED(XERCESC_INCLUDE XERCESC_LIBRARIES)