FindXALAN.cmake 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 Xalan xml library
  17. # Once done this will define
  18. #
  19. # XALAN_FOUND - system has the Xalan library
  20. # XALAN_INCLUDE_DIR - the Xalan include directory
  21. # XALAN_LIBRARIES - The libraries needed to use Xalan
  22. IF (NOT XALAN_FOUND)
  23. IF (WIN32)
  24. SET (xalan_libs "Xalan-C_1")
  25. ELSE()
  26. SET (xalan_libs "xalan-c")
  27. ENDIF()
  28. IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  29. IF (UNIX)
  30. IF (${ARCH64BIT} EQUAL 1)
  31. SET (osdir "linux64_gcc4.1.1")
  32. ELSE()
  33. SET (osdir "linux32_gcc4.1.1")
  34. ENDIF()
  35. ELSEIF(WIN32)
  36. IF (${ARCH64BIT} EQUAL 1)
  37. SET (osdir "xalan-c/win64")
  38. ELSE()
  39. SET (osdir "xalan-c/win32")
  40. ENDIF()
  41. ELSE()
  42. SET (osdir "unknown")
  43. ENDIF()
  44. IF (NOT ("${osdir}" STREQUAL "unknown"))
  45. FIND_PATH (XALAN_INCLUDE_DIR NAMES xalanc/XPath/XObjectFactory.hpp PATHS "${EXTERNALS_DIRECTORY}/xalan/${osdir}/include"
  46. "${EXTERNALS_DIRECTORY}/xalan/xalan-c/include" NO_DEFAULT_PATH)
  47. FIND_LIBRARY (XALAN_LIBRARIES NAMES ${xalan_libs} PATHS "${EXTERNALS_DIRECTORY}/xalan/${osdir}/lib" NO_DEFAULT_PATH)
  48. ENDIF()
  49. ENDIF()
  50. if (USE_NATIVE_LIBRARIES)
  51. # if we didn't find in externals, look in system include path
  52. FIND_PATH (XALAN_INCLUDE_DIR NAMES xalanc/XPath/XObjectFactory.hpp )
  53. FIND_LIBRARY (XALAN_LIBRARIES NAMES ${xalan_libs})
  54. endif()
  55. include(FindPackageHandleStandardArgs)
  56. find_package_handle_standard_args(Xalan DEFAULT_MSG
  57. XALAN_LIBRARIES
  58. XALAN_INCLUDE_DIR
  59. )
  60. IF (XALAN_FOUND)
  61. IF (WIN32)
  62. STRING(REPLACE "Xalan-C_1" "Xalan-C_1D" XALAN_DEBUG_LIBRARIES "${XALAN_LIBRARIES}")
  63. set (XALAN_LIBRARIES optimized ${XALAN_LIBRARIES} debug ${XALAN_DEBUG_LIBRARIES})
  64. ELSE()
  65. STRING(REPLACE "xalan-c" "xalanMsg" XALAN_EXTRA_LIBRARIES "${XALAN_LIBRARIES}")
  66. IF (EXISTS ${XALAN_EXTRA_LIBRARIES})
  67. set (XALAN_LIBRARIES ${XALAN_LIBRARIES} ${XALAN_EXTRA_LIBRARIES})
  68. ENDIF()
  69. ENDIF()
  70. ENDIF()
  71. MARK_AS_ADVANCED(XALAN_INCLUDE_DIR XALAN_LIBRARIES)
  72. ENDIF()