FindXERCES.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ################################################################################
  2. # Copyright (C) 2011 HPCC Systems.
  3. #
  4. # All rights reserved. This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as
  6. # published by the Free Software Foundation, either version 3 of the
  7. # License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ################################################################################
  17. # - Try to find the Xerces xml library
  18. # Once done this will define
  19. #
  20. # XERCES_FOUND - system has the Xerces library
  21. # XERCES_INCLUDE_DIR - the Xerces include directory
  22. # XERCES_LIBRARIES - The libraries needed to use Xerces
  23. if (NOT XERCES_FOUND)
  24. IF (WIN32)
  25. SET (xerces_libs "xerces-c_2")
  26. ELSE()
  27. SET (xerces_libs "xerces-c")
  28. ENDIF()
  29. IF (NOT ${EXTERNALS_DIRECTORY} STREQUAL "")
  30. IF (UNIX)
  31. IF (${ARCH64BIT} EQUAL 1)
  32. SET (osdir "linux64_gcc4.1.1")
  33. ELSE()
  34. SET (osdir "linux32_gcc4.1.1")
  35. ENDIF()
  36. ELSEIF(WIN32)
  37. SET (osdir "xerces-c/lib")
  38. ELSE()
  39. SET (osdir "unknown")
  40. ENDIF()
  41. IF (NOT ("${osdir}" STREQUAL "unknown"))
  42. FIND_PATH (XERCES_INCLUDE_DIR NAMES xercesc/util/XercesDefs.hpp PATHS "${EXTERNALS_DIRECTORY}/xalan/xerces-c/include" NO_DEFAULT_PATH)
  43. FIND_LIBRARY (XERCES_LIBRARIES NAMES ${xerces_libs} PATHS "${EXTERNALS_DIRECTORY}/xalan/${osdir}" NO_DEFAULT_PATH)
  44. ENDIF()
  45. ENDIF()
  46. if (USE_NATIVE_LIBRARIES)
  47. # if we didn't find in externals, look in system include path
  48. FIND_PATH (XERCES_INCLUDE_DIR NAMES xercesc/util/XercesDefs.hpp )
  49. FIND_LIBRARY (XERCES_LIBRARIES NAMES ${xerces_libs})
  50. endif()
  51. include(FindPackageHandleStandardArgs)
  52. find_package_handle_standard_args(Xerces DEFAULT_MSG
  53. XERCES_LIBRARIES
  54. XERCES_INCLUDE_DIR
  55. )
  56. IF (XERCES_FOUND AND WIN32)
  57. STRING(REPLACE "xerces-c_2" "xerces-c_2D" XERCES_DEBUG_LIBRARIES "${XERCES_LIBRARIES}")
  58. set (XERCES_LIBRARIES optimized ${XERCES_LIBRARIES} debug ${XERCES_DEBUG_LIBRARIES})
  59. ENDIF()
  60. MARK_AS_ADVANCED(XERCES_INCLUDE_DIR XERCES_LIBRARIES)
  61. ENDIF()