FindNeon.cmake 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # - Try to find Neon
  2. # Once done this will define
  3. #
  4. # NEON_FOUND - system has Neon
  5. # NEON_INCLUDE_DIRS - the Neon include directory
  6. # NEON_LIBRARIES - Link these to use Neon
  7. # NEON_DEFINITIONS - Compiler switches required for using Neon
  8. #
  9. # Copyright (c) 2011-2013 Andreas Schneider <asn@cryptomilk.org>
  10. #
  11. # Redistribution and use is allowed according to the terms of the New
  12. # BSD license.
  13. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  14. #
  15. find_package(PkgConfig)
  16. if (PKG_CONFIG_FOUND)
  17. pkg_check_modules(_NEON neon)
  18. endif (PKG_CONFIG_FOUND)
  19. include(GNUInstallDirs)
  20. find_path(NEON_INCLUDE_DIRS
  21. NAMES
  22. neon/ne_basic.h
  23. HINTS
  24. ${_NEON_INCLUDEDIR}
  25. ${CMAKE_INSTALL_INCLUDEDIR}
  26. )
  27. find_library(NEON_LIBRARIES
  28. NAMES
  29. neon
  30. HINTS
  31. ${_NEON_LIBDIR}
  32. ${CMAKE_INSTALL_LIBDIR}
  33. ${CMAKE_INSTALL_PREFIX}/lib
  34. ${CMAKE_INSTALL_PREFIX}/lib64
  35. )
  36. include(FindPackageHandleStandardArgs)
  37. find_package_handle_standard_args(Neon DEFAULT_MSG NEON_LIBRARIES NEON_INCLUDE_DIRS)
  38. # show the NEON_INCLUDE_DIRS and NEON_LIBRARIES variables only in the advanced view
  39. mark_as_advanced(NEON_INCLUDE_DIRS NEON_LIBRARIES)
  40. # Check if neon was compiled with LFS support, if so, the NE_LFS variable has to
  41. # be defined in the owncloud module.
  42. # If neon was not compiled with LFS its also ok since the underlying system
  43. # than probably supports large files anyway.
  44. IF( CMAKE_FIND_ROOT_PATH )
  45. FIND_PROGRAM( NEON_CONFIG_EXECUTABLE NAMES neon-config HINTS ${CMAKE_FIND_ROOT_PATH}/bin )
  46. ELSE( CMAKE_FIND_ROOT_PATH )
  47. FIND_PROGRAM( NEON_CONFIG_EXECUTABLE NAMES neon-config )
  48. ENDIF( CMAKE_FIND_ROOT_PATH )
  49. IF ( NEON_CONFIG_EXECUTABLE )
  50. MESSAGE(STATUS "neon-config executable: ${NEON_CONFIG_EXECUTABLE}")
  51. # neon-config --support lfs
  52. EXECUTE_PROCESS( COMMAND ${NEON_CONFIG_EXECUTABLE} "--support" "lfs"
  53. RESULT_VARIABLE LFS
  54. OUTPUT_STRIP_TRAILING_WHITESPACE )
  55. IF (LFS EQUAL 0)
  56. MESSAGE(STATUS "libneon has been compiled with LFS support")
  57. SET(NEON_WITH_LFS 1 PARENT_SCOPE)
  58. ELSE (LFS EQUAL 0)
  59. MESSAGE(STATUS "libneon has not been compiled with LFS support, rely on OS")
  60. ENDIF (LFS EQUAL 0)
  61. ELSE ( NEON_CONFIG_EXECUTABLE )
  62. MESSAGE(STATUS, "neon-config could not be found.")
  63. ENDIF ( NEON_CONFIG_EXECUTABLE )