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.

FindThirdPartyOgre3DTerrain.cmake 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # ---------------------------------
  2. # Finds Ogre3DTerrain toolkit
  3. #
  4. # Sets Ogre3DTerrain_FOUND
  5. # Sets Ogre3DTerrain_LIBRARIES
  6. # Sets Ogre3DTerrain_LIBRARY_DIRS
  7. # Sets Ogre3DTerrain_LDFLAGS
  8. # Sets Ogre3DTerrain_LDFLAGS_OTHERS
  9. # Sets Ogre3DTerrain_INCLUDE_DIRS
  10. # Sets Ogre3DTerrain_CFLAGS
  11. # Sets Ogre3DTerrain_CFLAGS_OTHERS
  12. #
  13. # Adds library to target
  14. # Adds include path
  15. # ---------------------------------
  16. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyOgre3DTerrain)
  17. IF(OV_DISABLE_OGRE)
  18. OV_PRINT(OV_PRINTED " SKIPPED Ogre3D (Terrain), disabled, no 3D ...")
  19. RETURN()
  20. ENDIF(OV_DISABLE_OGRE)
  21. IF(WIN32)
  22. FIND_PATH(PATH_Ogre3DTerrain include/OGRE/Ogre.h PATHS ${LIST_DEPENDENCIES_PATH} $ENV{OGRE_HOME} PATH_SUFFIXES ogre .)
  23. IF(PATH_Ogre3DTerrain)
  24. SET(Ogre3DTerrain_FOUND TRUE)
  25. SET(OIS_FOUND TRUE)
  26. SET(Ogre3DTerrain_INCLUDE_DIRS ${PATH_Ogre3DTerrain}/include/OGRE ${PATH_Ogre3DTerrain}/include/OIS)
  27. SET(Ogre3DTerrain_LIBRARIES_RELEASE OgreMain OIS)
  28. SET(Ogre3DTerrain_LIBRARY_DIRS_RELEASE ${PATH_Ogre3DTerrain}/lib/Release)
  29. SET(Ogre3DTerrain_LIBRARIES_DEBUG OgreMain_d OIS_d)
  30. SET(Ogre3DTerrain_LIBRARY_DIRS_DEBUG ${PATH_Ogre3DTerrain}/lib/Debug)
  31. ENDIF(PATH_Ogre3DTerrain)
  32. ENDIF(WIN32)
  33. IF(UNIX)
  34. INCLUDE("FindThirdPartyPkgConfig")
  35. pkg_check_modules(Ogre3DTerrain OGRE-Terrain)
  36. pkg_check_modules(OIS OIS)
  37. ENDIF(UNIX)
  38. IF(Ogre3DTerrain_FOUND AND OIS_FOUND)
  39. OV_PRINT(OV_PRINTED " Found Ogre3DTerrain/OIS...")
  40. INCLUDE_DIRECTORIES(${OIS_INCLUDE_DIRS} ${Ogre3DTerrain_INCLUDE_DIRS})
  41. ADD_DEFINITIONS(${OIS_CFLAGS} ${Ogre3DTerrain_CFLAGS})
  42. ADD_DEFINITIONS(${OIS_CFLAGS_OTHERS} ${Ogre3DTerrain_CFLAGS_OTHERS})
  43. # OV_PRINT(OV_PRINTED "A ${OIS_CFLAGS} ${Ogre3DTerrain_CFLAGS} B ${OIS_CFLAGS_OTHERS} ${Ogre3DTerrain_CFLAGS_OTHERS} C ${Ogre3DTerrain_LIBRARIES_RELEASE} D ${Ogre3DTerrain_LIBRARIES_DEBUG}")
  44. IF(UNIX)
  45. FOREACH(Ogre3DTerrain_LIB ${Ogre3DTerrain_LIBRARIES} ${OIS_LIBRARIES})
  46. SET(Ogre3DTerrain_LIB1 "Ogre3DTerrain_LIB1-NOTFOUND")
  47. FIND_LIBRARY(Ogre3DTerrain_LIB1 NAMES ${Ogre3DTerrain_LIB} PATHS ${Ogre3DTerrain_LIBRARY_DIRS} ${Ogre3DTerrain_LIBDIR} NO_DEFAULT_PATH)
  48. FIND_LIBRARY(Ogre3DTerrain_LIB1 NAMES ${Ogre3DTerrain_LIB})
  49. IF(Ogre3DTerrain_LIB1)
  50. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3DTerrain_LIB1}")
  51. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Ogre3DTerrain_LIB1})
  52. ELSE(Ogre3DTerrain_LIB1)
  53. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${Ogre3DTerrain_LIB}")
  54. ENDIF(Ogre3DTerrain_LIB1)
  55. ENDFOREACH(Ogre3DTerrain_LIB)
  56. ENDIF(UNIX)
  57. IF(WIN32)
  58. FOREACH(Ogre3DTerrain_LIB ${Ogre3DTerrain_LIBRARIES_RELEASE})
  59. SET(Ogre3DTerrain_LIB1 "Ogre3DTerrain_LIB1-NOTFOUND")
  60. FIND_LIBRARY(Ogre3DTerrain_LIB1 NAMES ${Ogre3DTerrain_LIB} PATHS ${Ogre3DTerrain_LIBRARY_DIRS_RELEASE} ${Ogre3DTerrain_LIBDIR} NO_DEFAULT_PATH)
  61. FIND_LIBRARY(Ogre3DTerrain_LIB1 NAMES ${Ogre3DTerrain_LIB})
  62. IF(Ogre3DTerrain_LIB1)
  63. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3DTerrain_LIB1}")
  64. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${Ogre3DTerrain_LIB1})
  65. ELSE(Ogre3DTerrain_LIB1)
  66. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${Ogre3DTerrain_LIB}")
  67. ENDIF(Ogre3DTerrain_LIB1)
  68. ENDFOREACH(Ogre3DTerrain_LIB)
  69. FOREACH(Ogre3DTerrain_LIB ${Ogre3DTerrain_LIBRARIES_DEBUG})
  70. SET(Ogre3DTerrain_LIB1 "Ogre3DTerrain_LIB1-NOTFOUND")
  71. FIND_LIBRARY(Ogre3DTerrain_LIB1 NAMES ${Ogre3DTerrain_LIB} PATHS ${Ogre3DTerrain_LIBRARY_DIRS_DEBUG} ${Ogre3DTerrain_LIBDIR} NO_DEFAULT_PATH)
  72. FIND_LIBRARY(Ogre3DTerrain_LIB1 NAMES ${Ogre3DTerrain_LIB})
  73. IF(Ogre3DTerrain_LIB1)
  74. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3DTerrain_LIB1}")
  75. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${Ogre3DTerrain_LIB1})
  76. ELSE(Ogre3DTerrain_LIB1)
  77. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${Ogre3DTerrain_LIB}")
  78. ENDIF(Ogre3DTerrain_LIB1)
  79. ENDFOREACH(Ogre3DTerrain_LIB)
  80. ENDIF(WIN32)
  81. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyOgre3DTerrain)
  82. ELSE(Ogre3DTerrain_FOUND AND OIS_FOUND)
  83. OV_PRINT(OV_PRINTED " FAILED to find Ogre3DTerrain/OIS...")
  84. ENDIF(Ogre3DTerrain_FOUND AND OIS_FOUND)
  85. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyOgre3DTerrain "Yes")