2018-11-05 20:27:47 +01:00
|
|
|
cmake_minimum_required (VERSION 3.2)
|
2018-08-30 14:03:25 +02:00
|
|
|
project (whyblocked
|
2019-01-12 19:35:24 +01:00
|
|
|
VERSION 0.14.0
|
2018-08-30 14:03:25 +02:00
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
|
2018-10-23 06:28:04 +02: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 18:07:01 +01:00
|
|
|
# because the sqlite3 in Debian jessie doesn't come with a pkg-config module.
|
2018-10-23 06:28:04 +02:00
|
|
|
pkg_check_modules(SQLITE3 sqlite3)
|
2018-10-18 21:31:05 +02:00
|
|
|
find_package(Qt5Core CONFIG REQUIRED)
|
2018-10-18 00:27:51 +02:00
|
|
|
if(NOT WITHOUT_GUI)
|
|
|
|
find_package(Qt5Widgets CONFIG REQUIRED)
|
2018-11-03 12:59:49 +01:00
|
|
|
pkg_check_modules(LIBCONFIG REQUIRED libconfig++)
|
2018-10-18 00:27:51 +02:00
|
|
|
endif()
|
2018-08-30 14:03:25 +02:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2019-01-12 17:39:20 +01:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
"${CMAKE_CXX_FLAGS_DEBUG} -Wpedantic -Wall -Wextra -g -Og -fno-omit-frame-pointer")
|
2018-08-30 14:03:25 +02:00
|
|
|
|
2018-10-06 21:33:02 +02:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
|
2018-08-30 14:03:25 +02:00
|
|
|
include_directories(${PROJECT_BINARY_DIR})
|
|
|
|
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
2018-10-22 19:15:55 +02:00
|
|
|
include_directories(${SQLITE3_INCLUDE_DIRS})
|
2018-11-03 12:59:49 +01:00
|
|
|
include_directories(${LIBCONFIG_INCLUDE_DIRS})
|
2018-08-30 14:03:25 +02:00
|
|
|
|
|
|
|
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
2018-10-22 19:15:55 +02:00
|
|
|
link_directories(${SQLITE3_LIBRARY_DIRS})
|
2018-11-03 12:59:49 +01:00
|
|
|
link_directories(${LIBCONFIG_LIBRARY_DIRS})
|
2018-08-30 14:03:25 +02:00
|
|
|
|
|
|
|
# Write version in header
|
|
|
|
configure_file (
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/version.hpp"
|
|
|
|
)
|
|
|
|
|
2018-10-22 19:15:55 +02:00
|
|
|
set(COMMON_LIBRARIES
|
2018-10-23 01:14:26 +02:00
|
|
|
${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp stdc++fs)
|
2018-10-22 19:15:55 +02:00
|
|
|
|
2019-01-12 18:22:05 +01:00
|
|
|
# add_executable(whyblocked
|
|
|
|
# src/interface_text.cpp src/whyblocked.cpp)
|
|
|
|
# target_link_libraries(whyblocked ${COMMON_LIBRARIES} Qt5::Core)
|
|
|
|
# install(TARGETS whyblocked DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2018-08-30 19:51:46 +02:00
|
|
|
|
2018-10-18 00:27:51 +02:00
|
|
|
if(NOT WITHOUT_GUI)
|
2018-11-03 12:59:49 +01:00
|
|
|
add_executable(whyblocked-gui
|
|
|
|
src/interface_qt.cpp src/whyblocked.cpp src/xdgcfg.cpp)
|
|
|
|
target_link_libraries(whyblocked-gui
|
|
|
|
${COMMON_LIBRARIES} Qt5::Widgets
|
|
|
|
${LIBCONFIG_LIBRARIES} stdc++fs)
|
2018-10-18 00:18:11 +02:00
|
|
|
|
|
|
|
install(TARGETS whyblocked-gui DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
install(FILES de.tastytea.Whyblocked.desktop DESTINATION
|
|
|
|
${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
2018-10-22 00:11:14 +02:00
|
|
|
install(FILES de.tastytea.Whyblocked.appdata.xml DESTINATION
|
|
|
|
${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
|
2018-10-20 00:34:00 +02:00
|
|
|
install(FILES de.tastytea.Whyblocked.svg DESTINATION
|
|
|
|
${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
|
2018-10-07 01:44:59 +02:00
|
|
|
endif()
|
2018-10-06 21:33:02 +02:00
|
|
|
|
2018-10-20 07:19:14 +02:00
|
|
|
if(NOT WITHOUT_TRANSLATIONS)
|
|
|
|
add_subdirectory(translations)
|
2018-08-30 19:51:46 +02:00
|
|
|
endif()
|
|
|
|
|
2018-10-20 07:19:14 +02:00
|
|
|
include(packages.CMakeLists.txt)
|