Findstemmer.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # - Find STEMMER library
  2. # Find the native STEMMER includes and library
  3. # This module defines
  4. # STEMMER_INCLUDE_DIR, where to find libstemmer.h, etc.
  5. # STEMMER_LIBRARIES, libraries to link against to use STEMMER.
  6. # STEMMER_FOUND, If false, do not try to use STEMMER.
  7. #=============================================================================
  8. # Copyright 2014 Sphinx Technologies, Inc.
  9. #
  10. # Distributed under the OSI-approved BSD License (the "License");
  11. # see accompanying file Copyright.txt for details.
  12. #
  13. # This software is distributed WITHOUT ANY WARRANTY; without even the
  14. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. # See the License for more information.
  16. #=============================================================================
  17. # (To distribute this file outside of CMake, substitute the full
  18. # License text for the above reference.)
  19. FIND_PATH ( STEMMER_INCLUDE_DIR libstemmer.h ONLY_CMAKE_FIND_ROOT_PATH )
  20. SET ( STEMMER_NAMES ${STEMMER_NAMES} stemmer stemmer_c )
  21. FIND_LIBRARY ( STEMMER_LIBRARY NAMES ${STEMMER_NAMES} ONLY_CMAKE_FIND_ROOT_PATH )
  22. # handle the QUIETLY and REQUIRED arguments and set STEMMER_FOUND to TRUE if
  23. # all listed variables are TRUE
  24. include ( FindPackageHandleStandardArgs )
  25. FIND_PACKAGE_HANDLE_STANDARD_ARGS ( stemmer REQUIRED_VARS STEMMER_LIBRARY STEMMER_INCLUDE_DIR )
  26. MARK_AS_ADVANCED ( STEMMER_INCLUDE_DIR STEMMER_LIBRARY )
  27. if (STEMMER_FOUND AND NOT TARGET stemmer::stemmer)
  28. add_library ( stemmer::stemmer UNKNOWN IMPORTED )
  29. set_target_properties ( stemmer::stemmer PROPERTIES
  30. IMPORTED_LOCATION "${STEMMER_LIBRARY}"
  31. INTERFACE_INCLUDE_DIRECTORIES "${STEMMER_INCLUDE_DIR}"
  32. )
  33. endif ()