libravatarserv/CMakeLists.txt

43 lines
1.4 KiB
CMake
Raw Normal View History

2018-11-24 11:00:07 +01:00
cmake_minimum_required (VERSION 3.2)
project(libravatarserv
VERSION 0.3.0
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++)
pkg_check_modules(LIBCRYPTOPP REQUIRED libcryptopp)
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})