FindCkConnector.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # - Try to find the ConsoleKit connector library (libck-connector)
  2. # Once done this will define
  3. #
  4. # CKCONNECTOR_FOUND - system has the CK Connector
  5. # CKCONNECTOR_INCLUDE_DIR - the CK Connector include directory
  6. # CKCONNECTOR_LIBRARIES - the libraries needed to use CK Connector
  7. # Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
  8. # modeled after FindLibArt.cmake:
  9. # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
  10. #
  11. # Redistribution and use is allowed according to the terms of the BSD license.
  12. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  13. if (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
  14. # in cache already
  15. SET(CKCONNECTOR_FOUND TRUE)
  16. else (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
  17. IF (NOT WIN32)
  18. FIND_PACKAGE(PkgConfig)
  19. IF (PKG_CONFIG_FOUND)
  20. # use pkg-config to get the directories and then use these values
  21. # in the FIND_PATH() and FIND_LIBRARY() calls
  22. pkg_check_modules(_CKCONNECTOR_PC QUIET ck-connector)
  23. ENDIF (PKG_CONFIG_FOUND)
  24. ENDIF (NOT WIN32)
  25. FIND_PATH(CKCONNECTOR_INCLUDE_DIR ck-connector.h
  26. ${_CKCONNECTOR_PC_INCLUDE_DIRS}
  27. )
  28. FIND_LIBRARY(CKCONNECTOR_LIBRARIES NAMES ck-connector
  29. PATHS
  30. ${_CKCONNECTOR_PC_LIBDIR}
  31. )
  32. if (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
  33. set(CKCONNECTOR_FOUND TRUE)
  34. endif (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
  35. if (CKCONNECTOR_FOUND)
  36. if (NOT CkConnector_FIND_QUIETLY)
  37. message(STATUS "Found ck-connector: ${CKCONNECTOR_LIBRARIES}")
  38. endif (NOT CkConnector_FIND_QUIETLY)
  39. else (CKCONNECTOR_FOUND)
  40. if (CkConnector_FIND_REQUIRED)
  41. message(FATAL_ERROR "Could NOT find ck-connector")
  42. endif (CkConnector_FIND_REQUIRED)
  43. endif (CKCONNECTOR_FOUND)
  44. MARK_AS_ADVANCED(CKCONNECTOR_INCLUDE_DIR CKCONNECTOR_LIBRARIES)
  45. endif (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)