FindXERCES.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. # - Try to find the Xerces xml library
  17. # Once done this will define
  18. #
  19. # XERCES_FOUND - system has the Xerces library
  20. # XERCES_INCLUDE_DIR - the Xerces include directory
  21. # XERCES_LIBRARIES - The libraries needed to use Xerces
  22. if (NOT XERCES_FOUND)
  23. IF (WIN32)
  24. IF (${ARCH64BIT} EQUAL 1)
  25. SET (xerces_libs "xerces-c_3")
  26. ELSE()
  27. SET (xerces_libs "xerces-c_2")
  28. ENDIF()
  29. ELSE()
  30. SET (xerces_libs "xerces-c")
  31. ENDIF()
  32. IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  33. IF (UNIX)
  34. IF (${ARCH64BIT} EQUAL 1)
  35. SET (osdir "linux64_gcc4.1.1")
  36. ELSE()
  37. SET (osdir "linux32_gcc4.1.1")
  38. ENDIF()
  39. ELSEIF(WIN32)
  40. SET (osdir "xerces-c/lib")
  41. ELSE()
  42. SET (osdir "unknown")
  43. ENDIF()
  44. IF (NOT ("${osdir}" STREQUAL "unknown"))
  45. FIND_PATH (XERCES_INCLUDE_DIR NAMES xercesc/util/XercesDefs.hpp PATHS "${EXTERNALS_DIRECTORY}/xalan/xerces-c/include" NO_DEFAULT_PATH)
  46. FIND_LIBRARY (XERCES_LIBRARIES NAMES ${xerces_libs} PATHS "${EXTERNALS_DIRECTORY}/xalan/${osdir}" NO_DEFAULT_PATH)
  47. ENDIF()
  48. ENDIF()
  49. if (USE_NATIVE_LIBRARIES)
  50. # if we didn't find in externals, look in system include path
  51. FIND_PATH (XERCES_INCLUDE_DIR NAMES xercesc/util/XercesDefs.hpp )
  52. FIND_LIBRARY (XERCES_LIBRARIES NAMES ${xerces_libs})
  53. endif()
  54. include(FindPackageHandleStandardArgs)
  55. find_package_handle_standard_args(Xerces DEFAULT_MSG
  56. XERCES_LIBRARIES
  57. XERCES_INCLUDE_DIR
  58. )
  59. IF (XERCES_FOUND AND WIN32)
  60. STRING(REPLACE "xerces-c_2" "xerces-c_2D" XERCES_DEBUG_LIBRARIES "${XERCES_LIBRARIES}")
  61. set (XERCES_LIBRARIES optimized ${XERCES_LIBRARIES} debug ${XERCES_DEBUG_LIBRARIES})
  62. ENDIF()
  63. MARK_AS_ADVANCED(XERCES_INCLUDE_DIR XERCES_LIBRARIES)
  64. ENDIF()