CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. cmake_minimum_required(VERSION 2.6)
  2. project(mirall)
  3. set(PACKAGE "mirall")
  4. include(Warnings)
  5. set(OEM_THEME_DIR "" CACHE STRING "Define directory containing a custom theme")
  6. if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake )
  7. include ( ${OEM_THEME_DIR}/OEM.cmake )
  8. else ()
  9. include ( ${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake )
  10. endif()
  11. if (NOT DEFINED APPLICATION_SHORTNAME)
  12. set ( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
  13. endif()
  14. include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
  15. configure_file( ${CMAKE_SOURCE_DIR}/src/mirall/version.h.in "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/version.h" )
  16. include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
  17. #####
  18. ## handle DBUS for Fdo notifications
  19. if( UNIX AND NOT APPLE )
  20. add_definitions( -DUSE_FDO_NOTIFICATIONS)
  21. set(WITH_DBUS ON)
  22. endif()
  23. ####
  24. include(GNUInstallDirs)
  25. include(DefineInstallationPaths)
  26. include(QtVersionAbstraction)
  27. setup_qt()
  28. include(GetGitRevisionDescription)
  29. get_git_head_revision(GIT_REFSPEC GIT_SHA1)
  30. # if we cannot get it from git, directly try .tag (packages)
  31. # this will work if the tar balls have been properly created
  32. # via git-archive.
  33. if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
  34. file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
  35. string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
  36. if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
  37. message("${sha1_candidate}")
  38. set (GIT_SHA1 "${sha1_candidate}")
  39. endif()
  40. endif()
  41. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  42. set(DATADIR ${DATA_INSTALL_DIR})
  43. #####
  44. ## handle BUILD_OWNCLOUD_OSX_BUNDLE
  45. # BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
  46. if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
  47. set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
  48. set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
  49. # BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
  50. elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  51. message(FATAL_ERROR "Building in non-bundle mode on OSX is currently not supported. Comment this error out if you want to work on/test it.")
  52. # any other platform
  53. else()
  54. set(BUILD_OWNCLOUD_OSX_BUNDLE OFF)
  55. endif()
  56. #####
  57. #### find libs
  58. #find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
  59. #if( UNIX AND NOT APPLE ) # Fdo notifications
  60. # find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
  61. #endif()
  62. find_package(Neon REQUIRED)
  63. find_package(Csync REQUIRED)
  64. find_package(QtKeychain REQUIRED)
  65. if(UNIX)
  66. find_package(INotify REQUIRED)
  67. else()
  68. find_package(INotify)
  69. endif()
  70. find_package(Sphinx)
  71. find_package(PdfLatex)
  72. set(WITH_QTKEYCHAIN ${QTKEYCHAIN_FOUND})
  73. set(USE_INOTIFY ${INOTIFY_FOUND})
  74. configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  75. include(OwnCloudCPack.cmake)
  76. add_definitions(-DUNICODE)
  77. add_definitions(-D_UNICODE)
  78. # Handle Translations, pick all mirall_* files from trans directory.
  79. file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/mirall_*.ts)
  80. set(TRANSLATIONS ${TRANS_FILES})
  81. add_subdirectory(src)
  82. add_subdirectory(doc)
  83. if(UNIT_TESTING)
  84. include(CTest)
  85. enable_testing()
  86. add_subdirectory(test)
  87. endif(UNIT_TESTING)
  88. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  89. configure_file(sync-exclude.lst ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
  90. else()
  91. install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
  92. endif()