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.

FindThirdPartyGTK.cmake 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # ---------------------------------
  2. # Finds GTK toolkit
  3. #
  4. # Sets GTK_FOUND
  5. # Sets GTK_LIBRARIES
  6. # Sets GTK_LIBRARY_DIRS
  7. # Sets GTK_LDFLAGS
  8. # Sets GTK_LDFLAGS_OTHERS
  9. # Sets GTK_INCLUDE_DIRS
  10. # Sets GTK_CFLAGS
  11. # Sets GTK_CFLAGS_OTHERS
  12. # ---------------------------------
  13. INCLUDE("FindPkgConfig")
  14. IF(WIN32)
  15. pkg_check_modules(GTK gtk+-win32-2.0 gthread-2.0)
  16. ELSE(WIN32)
  17. pkg_check_modules(GTK "gtk+-2.0" "gthread-2.0")
  18. ENDIF(WIN32)
  19. IF(${OV_DEPENDENCIES_PLATFORM_FOLDER_NAME} STREQUAL "dependencies")
  20. SET(GTK_LIB_SUBFOLDER "2.10.0")
  21. SET(LIB_Z_NAME "zdll")
  22. ELSE()
  23. SET(GTK_LIB_SUBFOLDER "i686-pc-vs10")
  24. SET(LIB_Z_NAME "zlib1")
  25. ENDIF()
  26. IF(GTK_FOUND)
  27. debug_message( " Found GTK+...")
  28. # This is a bit convoluted way of finding zlib (because GTK_INCLUDE_DIRS
  29. # is actually a list of folders, not a single one)
  30. find_path(PATH_ZLIB gtk/include/zlib.h PATHS ${LIST_DEPENDENCIES_PATH} NO_DEFAULT_PATH)
  31. INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS} "${PATH_ZLIB}/gtk/include")
  32. #shouldn't add GTK_CFLAGS, this results in AdditionalIncludeDirectories becoming broken in visual studio
  33. #ADD_DEFINITIONS(${GTK_CFLAGS} ${GTK_CFLAGS_OTHERS} ${GTHREAD_CFLAGS}${GTHREAD_CFLAGS_OTHERS})
  34. #LINK_DIRECTORIES(${GTK_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS})
  35. IF(WIN32)
  36. SET( GTK_LIB_LIST ${GTK_LIBRARIES} ${GTHREAD_LIBRARIES} ${LIB_Z_NAME})
  37. ELSE(WIN32)
  38. SET( GTK_LIB_LIST ${GTK_LIBRARIES} ${GTHREAD_LIBRARIES} z)
  39. ENDIF(WIN32)
  40. IF(WIN32)
  41. # gdi32.lib could be under the MS Windows SDK
  42. INCLUDE("OvSetWindowsSDKPath")
  43. INSTALL(
  44. DIRECTORY ${GTK_LIBRARY_DIRS}/../bin/
  45. DESTINATION ${DIST_BINDIR}
  46. FILES_MATCHING PATTERN "*.dll")
  47. INSTALL(
  48. DIRECTORY ${GTK_LIBRARY_DIRS}/gtk-2.0/${GTK_LIB_SUBFOLDER}/engines/
  49. DESTINATION ${DIST_LIBDIR}/gtk-2.0/${GTK_LIB_SUBFOLDER}/engines/
  50. FILES_MATCHING PATTERN "*.dll")
  51. INSTALL(
  52. FILES ${GTK_LIBRARY_DIRS}/..//etc/gtk-2.0/gtkrc
  53. DESTINATION ${DIST_SYSCONFDIR}/gtk-2.0/)
  54. ENDIF()
  55. FOREACH(GTK_LIB ${GTK_LIB_LIST})
  56. SET(GTK_LIB1 "GTK_LIB1-NOTFOUND")
  57. FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${GTK_LIBRARY_DIRS} ${GTK_LIBDIR} NO_DEFAULT_PATH)
  58. FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${GTK_LIBRARY_DIRS} ${GTK_LIBDIR})
  59. IF(WIN32)
  60. FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${OV_MS_SDK_PATH}/lib)
  61. ENDIF(WIN32)
  62. IF(GTK_LIB1)
  63. debug_message( " [ OK ] Third party lib ${GTK_LIB1}")
  64. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${GTK_LIB1})
  65. ELSE(GTK_LIB1)
  66. MESSAGE(WARNING " [FAILED] Third party lib ${GTK_LIB}")
  67. ENDIF(GTK_LIB1)
  68. ENDFOREACH(GTK_LIB)
  69. ELSE(GTK_FOUND)
  70. MESSAGE(WARNING " FAILED to find GTK+...")
  71. IF(NOT PKG_CONFIG_FOUND)
  72. MESSAGE(WARNING " Did not even find pkg-config exe")
  73. ENDIF(NOT PKG_CONFIG_FOUND)
  74. ENDIF(GTK_FOUND)