Whyblocked reminds you why you blocked someone.
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.

CMakeLists.txt 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. cmake_minimum_required (VERSION 3.2)
  2. project (whyblocked
  3. VERSION 0.15.0
  4. LANGUAGES CXX
  5. )
  6. include(GNUInstallDirs)
  7. find_package(PkgConfig REQUIRED)
  8. pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
  9. # sqlite3 is not a direct dependency, but vsqlite++ has no cmake- or pkg-config
  10. # module. Since it installs in the same directories as sqlite3, I am adding the
  11. # module here to add the include- and link directories below. It is not REQUIRED
  12. # because the sqlite3 in Debian jessie doesn't come with a pkg-config module.
  13. pkg_check_modules(SQLITE3 sqlite3)
  14. find_package(Qt5Core CONFIG REQUIRED)
  15. find_package(Qt5Widgets CONFIG REQUIRED)
  16. pkg_check_modules(LIBCONFIG REQUIRED libconfig++)
  17. set(CMAKE_CXX_STANDARD 14)
  18. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  19. set(CMAKE_CXX_EXTENSIONS OFF)
  20. set(CMAKE_CXX_FLAGS_DEBUG
  21. "${CMAKE_CXX_FLAGS_DEBUG} -Wpedantic -Wall -Wextra -g -Og -fno-omit-frame-pointer")
  22. set(CMAKE_AUTOMOC ON)
  23. set(CMAKE_AUTOUIC ON)
  24. include_directories(${PROJECT_BINARY_DIR})
  25. include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
  26. include_directories(${SQLITE3_INCLUDE_DIRS})
  27. include_directories(${LIBCONFIG_INCLUDE_DIRS})
  28. link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
  29. link_directories(${SQLITE3_LIBRARY_DIRS})
  30. link_directories(${LIBCONFIG_LIBRARY_DIRS})
  31. # Write version in header
  32. configure_file (
  33. "${PROJECT_SOURCE_DIR}/src/version.hpp.in"
  34. "${PROJECT_BINARY_DIR}/version.hpp"
  35. )
  36. add_executable(${CMAKE_PROJECT_NAME}
  37. src/qt/main.cpp src/qt/mainwindow.cpp src/qt/dialog_add.cpp
  38. src/whyblocked.cpp src/xdgcfg.cpp)
  39. target_link_libraries(${CMAKE_PROJECT_NAME}
  40. ${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp Qt5::Widgets
  41. ${LIBCONFIG_LIBRARIES} stdc++fs)
  42. set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"")
  43. add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
  44. WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
  45. COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_PROJECT_NAME} whyblocked-gui)
  46. if(WITH_MAN)
  47. add_custom_command(
  48. OUTPUT "${PROJECT_BINARY_DIR}/whyblocked.1"
  49. WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
  50. DEPENDS "${CMAKE_SOURCE_DIR}/whyblocked.1.adoc"
  51. COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh
  52. ARGS ${PROJECT_VERSION})
  53. add_custom_target(run ALL
  54. DEPENDS "${PROJECT_BINARY_DIR}/whyblocked.1"
  55. )
  56. endif()
  57. install(TARGETS ${CMAKE_PROJECT_NAME}
  58. DESTINATION ${CMAKE_INSTALL_BINDIR})
  59. install(FILES "${PROJECT_BINARY_DIR}/whyblocked-gui"
  60. DESTINATION "${CMAKE_INSTALL_BINDIR}")
  61. install(FILES de.tastytea.Whyblocked.desktop
  62. DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
  63. install(FILES de.tastytea.Whyblocked.appdata.xml
  64. DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
  65. install(FILES de.tastytea.Whyblocked.svg
  66. DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
  67. if(WITH_MAN)
  68. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/whyblocked.1
  69. DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
  70. endif()
  71. set(WITH_TRANSLATIONS "YES" CACHE STRING "WITH_TRANSLATIONS defaults to \"YES\"")
  72. if(WITH_TRANSLATIONS)
  73. add_subdirectory(translations)
  74. endif()
  75. include(packages.CMakeLists.txt)