You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyX11.cmake 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # ---------------------------------
  2. # Finds X11 toolkit
  3. #
  4. # Sets X11_FOUND
  5. # Sets X11_LIBRARIES
  6. # Sets X11_LIBRARY_DIRS
  7. # Sets X11_LDFLAGS
  8. # Sets X11_LDFLAGS_OTHERS
  9. # Sets X11_INCLUDE_DIRS
  10. # Sets X11_CFLAGS
  11. # Sets X11_CFLAGS_OTHERS
  12. # ---------------------------------
  13. IF(UNIX)
  14. SET(OLD_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
  15. IF(APPLE)
  16. SET(CMAKE_PREFIX_PATH "/opt/X11")
  17. ENDIF()
  18. INCLUDE("FindPkgConfig")
  19. pkg_check_modules(X11 x11)
  20. IF(X11_FOUND)
  21. debug_message( " Found X11... ${X11_INCLUDE_DIRS}")
  22. INCLUDE_DIRECTORIES(${X11_INCLUDE_DIRS})
  23. ADD_DEFINITIONS(${X11_CFLAGS})
  24. ADD_DEFINITIONS(${X11_CFLAGS_OTHERS})
  25. # LINK_DIRECTORIES(${X11_LIBRARY_DIRS})
  26. FOREACH(X11_LIB ${X11_LIBRARIES})
  27. SET(X11_LIB1 "X11_LIB1-NOTFOUND")
  28. FIND_LIBRARY(X11_LIB1 NAMES ${X11_LIB} PATHS ${X11_LIBRARY_DIRS} ${X11_LIBDIR} NO_DEFAULT_PATH)
  29. FIND_LIBRARY(X11_LIB1 NAMES ${X11_LIB})
  30. IF(X11_LIB1)
  31. debug_message( " [ OK ] Third party lib ${X11_LIB1}")
  32. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${X11_LIB1})
  33. ELSE(X11_LIB1)
  34. MESSAGE(WARNING " [FAILED] Third party lib ${X11_LIB}")
  35. ENDIF(X11_LIB1)
  36. ENDFOREACH(X11_LIB)
  37. ELSE(X11_FOUND)
  38. MESSAGE(WARNING " FAILED to find X11...")
  39. ENDIF(X11_FOUND)
  40. SET(CMAKE_PREFIX_PATH ${OLD_CMAKE_PREFIX_PATH})
  41. ENDIF(UNIX)