FindYAMLCPP.cmake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Locate yaml-cpp
  2. #
  3. # This module defines
  4. # YAMLCPP_FOUND, if false, do not try to link to yaml-cpp
  5. # YAMLCPP_LIBRARY, where to find yaml-cpp
  6. # YAMLCPP_INCLUDE_DIR, where to find yaml.h
  7. #
  8. # By default, the dynamic libraries of yaml-cpp will be found. To find the static ones instead,
  9. # you must set the YAMLCPP_STATIC_LIBRARY variable to TRUE before calling find_package(YamlCpp ...).
  10. #
  11. # If yaml-cpp is not installed in a standard path, you can use the YAMLCPP_DIR CMake variable
  12. # to tell CMake where yaml-cpp is.
  13. # attempt to find static library first if this is set
  14. if(YAMLCPP_STATIC_LIBRARY)
  15. set(YAMLCPP_STATIC libyaml-cpp.a)
  16. endif()
  17. # find the yaml-cpp include directory
  18. find_path(YAMLCPP_INCLUDE_DIR yaml-cpp/yaml.h
  19. PATH_SUFFIXES include
  20. PATHS
  21. ~/Library/Frameworks/yaml-cpp/include/
  22. /Library/Frameworks/yaml-cpp/include/
  23. /usr/local/include/
  24. /usr/include/
  25. /sw/yaml-cpp/ # Fink
  26. /opt/local/yaml-cpp/ # DarwinPorts
  27. /opt/csw/yaml-cpp/ # Blastwave
  28. /opt/yaml-cpp/
  29. ${YAMLCPP_DIR}/include/)
  30. # find the yaml-cpp library
  31. find_library(YAMLCPP_LIBRARY
  32. NAMES ${YAMLCPP_STATIC} yaml-cpp
  33. PATH_SUFFIXES lib64 lib
  34. PATHS ~/Library/Frameworks
  35. /Library/Frameworks
  36. /usr/local
  37. /usr
  38. /sw
  39. /opt/local
  40. /opt/csw
  41. /opt
  42. ${YAMLCPP_DIR}/lib)
  43. # handle the QUIETLY and REQUIRED arguments and set YAMLCPP_FOUND to TRUE if all listed variables are TRUE
  44. include(FindPackageHandleStandardArgs)
  45. FIND_PACKAGE_HANDLE_STANDARD_ARGS(YAMLCPP DEFAULT_MSG YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY)
  46. mark_as_advanced(YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY)