2018-11-24 11:00:07 +01:00
|
|
|
cmake_minimum_required (VERSION 3.2)
|
|
|
|
project(libravatarserv
|
2018-11-27 05:15:35 +01:00
|
|
|
VERSION 0.4.3
|
2018-11-24 11:00:07 +01:00
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
2018-11-24 12:40:49 +01:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2018-11-25 06:00:45 +01:00
|
|
|
pkg_check_modules(MAGICPP REQUIRED Magick++)
|
2018-11-26 05:50:35 +01:00
|
|
|
pkg_check_modules(LIBCRYPTOPP libcryptopp)
|
|
|
|
if(NOT LIBCRYPTOPP_FOUND)
|
|
|
|
# Debian stretch package installs libcrypto++.pc
|
|
|
|
pkg_check_modules(LIBCRYPTOPP REQUIRED libcrypto++)
|
|
|
|
endif()
|
2018-11-25 06:00:45 +01:00
|
|
|
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
|
2018-11-24 11:00:07 +01:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2018-11-25 06:00:45 +01:00
|
|
|
string(REPLACE ";" " " MAGICPP_CFLAGS_STRING "${MAGICPP_CFLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MAGICPP_CFLAGS_STRING}")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
"${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic -Wextra -g -Og")
|
2018-11-24 11:00:07 +01:00
|
|
|
|
|
|
|
include_directories(${PROJECT_BINARY_DIR})
|
2018-11-25 06:00:45 +01:00
|
|
|
include_directories(${MAGICPP_INCLUDE_DIRS})
|
|
|
|
include_directories(${LIBCRYPTOPP_INCLUDE_DIRS})
|
|
|
|
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
2018-11-24 12:40:49 +01:00
|
|
|
|
2018-11-25 06:00:45 +01:00
|
|
|
link_directories(${MAGICPP_LIBRARY_DIRS})
|
|
|
|
link_directories(${LIBCRYPTOPP_LIBRARY_DIRS})
|
|
|
|
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
2018-11-24 11:00:07 +01:00
|
|
|
|
|
|
|
# Write version in header
|
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/version.hpp"
|
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB sources src/*.cpp)
|
2018-11-25 06:00:45 +01:00
|
|
|
add_executable(${CMAKE_PROJECT_NAME} "${sources}")
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
|
|
|
"${MAGICPP_LDFLAGS} ${LIBCRYPTOPP_LDFLAGS}"
|
|
|
|
"${LIBXDG_BASEDIR_LDFLAGS} -lstdc++fs")
|
2018-11-24 11:00:07 +01:00
|
|
|
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2018-11-27 05:46:45 +01:00
|
|
|
|
|
|
|
include(packages.CMakeLists.txt)
|