2018-11-05 14:27:47 -05:00
|
|
|
cmake_minimum_required (VERSION 3.2)
|
2018-08-30 08:03:25 -04:00
|
|
|
project (whyblocked
|
2019-01-20 17:48:47 -05:00
|
|
|
VERSION 0.15.0
|
2018-08-30 08:03:25 -04:00
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
|
2018-10-23 00:28:04 -04:00
|
|
|
# sqlite3 is not a direct dependency, but vsqlite++ has no cmake- or pkg-config
|
|
|
|
# module. Since it installs in the same directories as sqlite3, I am adding the
|
|
|
|
# module here to add the include- and link directories below. It is not REQUIRED
|
2018-11-05 12:07:01 -05:00
|
|
|
# because the sqlite3 in Debian jessie doesn't come with a pkg-config module.
|
2018-10-23 00:28:04 -04:00
|
|
|
pkg_check_modules(SQLITE3 sqlite3)
|
2018-10-18 15:31:05 -04:00
|
|
|
find_package(Qt5Core CONFIG REQUIRED)
|
2019-01-12 15:28:29 -05:00
|
|
|
find_package(Qt5Widgets CONFIG REQUIRED)
|
|
|
|
pkg_check_modules(LIBCONFIG REQUIRED libconfig++)
|
2018-08-30 08:03:25 -04:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2019-01-12 11:39:20 -05:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
"${CMAKE_CXX_FLAGS_DEBUG} -Wpedantic -Wall -Wextra -g -Og -fno-omit-frame-pointer")
|
2018-08-30 08:03:25 -04:00
|
|
|
|
2018-10-06 15:33:02 -04:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
|
2018-08-30 08:03:25 -04:00
|
|
|
include_directories(${PROJECT_BINARY_DIR})
|
|
|
|
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
2018-10-22 13:15:55 -04:00
|
|
|
include_directories(${SQLITE3_INCLUDE_DIRS})
|
2018-11-03 07:59:49 -04:00
|
|
|
include_directories(${LIBCONFIG_INCLUDE_DIRS})
|
2018-08-30 08:03:25 -04:00
|
|
|
|
|
|
|
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
2018-10-22 13:15:55 -04:00
|
|
|
link_directories(${SQLITE3_LIBRARY_DIRS})
|
2018-11-03 07:59:49 -04:00
|
|
|
link_directories(${LIBCONFIG_LIBRARY_DIRS})
|
2018-08-30 08:03:25 -04:00
|
|
|
|
|
|
|
# Write version in header
|
|
|
|
configure_file (
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/version.hpp"
|
|
|
|
)
|
|
|
|
|
2019-01-20 17:46:41 -05:00
|
|
|
add_executable(${CMAKE_PROJECT_NAME}
|
2019-01-14 09:45:05 -05:00
|
|
|
src/qt/main.cpp src/qt/mainwindow.cpp src/qt/dialog_add.cpp
|
|
|
|
src/whyblocked.cpp src/xdgcfg.cpp)
|
2019-01-20 17:46:41 -05:00
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
2019-01-12 15:28:29 -05:00
|
|
|
${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp Qt5::Widgets
|
|
|
|
${LIBCONFIG_LIBRARIES} stdc++fs)
|
2019-01-20 18:27:38 -05:00
|
|
|
set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"")
|
2019-01-20 18:29:29 -05:00
|
|
|
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
|
|
|
|
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_PROJECT_NAME} whyblocked-gui)
|
|
|
|
|
2019-01-20 17:31:58 -05:00
|
|
|
if(WITH_MAN)
|
2019-01-20 19:07:04 -05:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${PROJECT_BINARY_DIR}/whyblocked.1"
|
2019-01-20 17:46:41 -05:00
|
|
|
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
|
2019-01-20 19:07:04 -05:00
|
|
|
DEPENDS "${CMAKE_SOURCE_DIR}/whyblocked.1.adoc"
|
2019-01-20 17:31:58 -05:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh
|
2019-01-20 18:09:24 -05:00
|
|
|
ARGS ${PROJECT_VERSION})
|
2019-01-20 19:07:04 -05:00
|
|
|
add_custom_target(run ALL
|
|
|
|
DEPENDS "${PROJECT_BINARY_DIR}/whyblocked.1"
|
|
|
|
)
|
2019-01-20 17:31:58 -05:00
|
|
|
endif()
|
2018-10-17 18:18:11 -04:00
|
|
|
|
2019-01-20 17:46:41 -05:00
|
|
|
install(TARGETS ${CMAKE_PROJECT_NAME}
|
|
|
|
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
install(FILES "${PROJECT_BINARY_DIR}/whyblocked-gui"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
|
|
install(FILES de.tastytea.Whyblocked.desktop
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
|
|
|
install(FILES de.tastytea.Whyblocked.appdata.xml
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
|
|
|
|
install(FILES de.tastytea.Whyblocked.svg
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
|
2019-01-20 17:31:58 -05:00
|
|
|
if(WITH_MAN)
|
2019-01-20 17:46:41 -05:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/whyblocked.1
|
|
|
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
2019-01-20 17:31:58 -05:00
|
|
|
endif()
|
2018-10-06 15:33:02 -04:00
|
|
|
|
2019-01-20 18:27:38 -05:00
|
|
|
set(WITH_TRANSLATIONS "YES" CACHE STRING "WITH_TRANSLATIONS defaults to \"YES\"")
|
2019-01-20 17:31:58 -05:00
|
|
|
if(WITH_TRANSLATIONS)
|
2018-10-20 01:19:14 -04:00
|
|
|
add_subdirectory(translations)
|
2018-08-30 13:51:46 -04:00
|
|
|
endif()
|
|
|
|
|
2018-10-20 01:19:14 -04:00
|
|
|
include(packages.CMakeLists.txt)
|