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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyGTK)
  14. IF(OV_DISABLE_GTK)
  15. OV_PRINT(OV_PRINTED " GTK disabled")
  16. RETURN()
  17. ENDIF(OV_DISABLE_GTK)
  18. INCLUDE("FindThirdPartyPkgConfig")
  19. IF(WIN32)
  20. pkg_check_modules(GTK gtk+-win32-2.0 gthread-2.0)
  21. ELSE(WIN32)
  22. pkg_check_modules(GTK "gtk+-2.0" "gthread-2.0")
  23. ENDIF(WIN32)
  24. IF(${OV_DEPENDENCIES_PLATFORM_FOLDER_NAME} STREQUAL "dependencies")
  25. SET(GTK_LIB_SUBFOLDER "2.10.0")
  26. SET(LIB_Z_NAME "zdll")
  27. ELSE()
  28. SET(GTK_LIB_SUBFOLDER "i686-pc-vs10")
  29. SET(LIB_Z_NAME "zlib1")
  30. ENDIF()
  31. IF(GTK_FOUND)
  32. OV_PRINT(OV_PRINTED " Found GTK+...")
  33. # optimistic...
  34. SET(GTK_FOUND_EVERYTHING "True")
  35. #shouldn't add GTK_CFLAGS, this results in AdditionalIncludeDirectories becoming broken in visual studio
  36. #ADD_DEFINITIONS(${GTK_CFLAGS} ${GTK_CFLAGS_OTHERS} ${GTHREAD_CFLAGS}${GTHREAD_CFLAGS_OTHERS})
  37. #LINK_DIRECTORIES(${GTK_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS})
  38. IF(WIN32)
  39. SET( GTK_LIB_LIST ${GTK_LIBRARIES} ${GTHREAD_LIBRARIES} ${LIB_Z_NAME})
  40. ELSE(WIN32)
  41. SET( GTK_LIB_LIST ${GTK_LIBRARIES} ${GTHREAD_LIBRARIES} z)
  42. ENDIF(WIN32)
  43. IF(WIN32)
  44. # gdi32.lib could be under the MS Windows SDK
  45. INCLUDE("OvSetWindowsSDKPath")
  46. ENDIF(WIN32)
  47. FOREACH(GTK_LIB ${GTK_LIB_LIST})
  48. SET(GTK_LIB1 "GTK_LIB1-NOTFOUND")
  49. FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${GTK_LIBRARY_DIRS} ${GTK_LIBDIR} NO_DEFAULT_PATH)
  50. FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${GTK_LIBRARY_DIRS} ${GTK_LIBDIR})
  51. IF(WIN32)
  52. FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${OV_MS_SDK_PATH}/lib)
  53. ENDIF(WIN32)
  54. IF(GTK_LIB1)
  55. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${GTK_LIB1}")
  56. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${GTK_LIB1})
  57. ELSE(GTK_LIB1)
  58. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${GTK_LIB}")
  59. SET(GTK_FOUND_EVERYTHING "-NOTFOUND")
  60. ENDIF(GTK_LIB1)
  61. ENDFOREACH(GTK_LIB)
  62. ENDIF(GTK_FOUND)
  63. IF(GTK_FOUND_EVERYTHING)
  64. INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS})
  65. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyGTK)
  66. ELSE(GTK_FOUND_EVERYTHING)
  67. OV_PRINT(OV_PRINTED " FAILED to find GTK+ or its components...")
  68. SET(OV_DISABLE_GTK TRUE)
  69. IF(NOT PKG_CONFIG_FOUND)
  70. OV_PRINT(OV_PRINTED " Did not even find pkg-config exe")
  71. ENDIF(NOT PKG_CONFIG_FOUND)
  72. ENDIF(GTK_FOUND_EVERYTHING)
  73. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyGTK "Yes")