cmake_minimum_required (VERSION 3.2) project(libravatarserv VERSION 0.4.3 LANGUAGES CXX ) include(GNUInstallDirs) find_package(PkgConfig REQUIRED) pkg_check_modules(MAGICPP REQUIRED Magick++) pkg_check_modules(LIBCRYPTOPP libcryptopp) if(NOT LIBCRYPTOPP_FOUND) # Debian stretch package installs libcrypto++.pc pkg_check_modules(LIBCRYPTOPP REQUIRED libcrypto++) endif() pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) 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") include_directories(${PROJECT_BINARY_DIR}) include_directories(${MAGICPP_INCLUDE_DIRS}) include_directories(${LIBCRYPTOPP_INCLUDE_DIRS}) include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS}) link_directories(${MAGICPP_LIBRARY_DIRS}) link_directories(${LIBCRYPTOPP_LIBRARY_DIRS}) link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS}) # Write version in header configure_file( "${PROJECT_SOURCE_DIR}/src/version.hpp.in" "${PROJECT_BINARY_DIR}/version.hpp" ) file(GLOB sources src/*.cpp) add_executable(${CMAKE_PROJECT_NAME} "${sources}") target_link_libraries(${CMAKE_PROJECT_NAME} "${MAGICPP_LDFLAGS} ${LIBCRYPTOPP_LDFLAGS}" "${LIBXDG_BASEDIR_LDFLAGS} -lstdc++fs") install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) include(packages.CMakeLists.txt)