2018-05-11 02:21:44 +02:00
|
|
|
cmake_minimum_required (VERSION 3.7)
|
|
|
|
project (expandurl-mastodon
|
2018-05-27 16:08:49 +02:00
|
|
|
VERSION 0.8.0
|
2018-05-11 02:21:44 +02:00
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
2018-05-13 07:01:30 +02:00
|
|
|
find_package(CURL REQUIRED)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(CURLPP REQUIRED curlpp)
|
|
|
|
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
|
2018-05-27 16:08:49 +02:00
|
|
|
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
|
2018-05-11 02:21:44 +02:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2018-05-13 14:21:12 +02:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
|
2018-05-22 20:45:54 +02:00
|
|
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
# uint_fast16_t can be bigger than 16 bit, but that doesn't matter because
|
|
|
|
# everything but the last 16 bit is padded with zeroes.
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format")
|
|
|
|
endif()
|
2018-05-13 14:21:12 +02:00
|
|
|
|
2018-05-11 02:21:44 +02:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
|
|
|
include_directories(${PROJECT_BINARY_DIR})
|
|
|
|
|
2018-05-13 07:01:30 +02:00
|
|
|
include_directories(${CURL_INCLUDE_DIRS})
|
|
|
|
include_directories(${CURLPP_INCLUDE_DIRS})
|
|
|
|
include_directories(${JSONCPP_INCLUDE_DIRS})
|
2018-05-27 16:08:49 +02:00
|
|
|
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
2018-05-13 07:01:30 +02:00
|
|
|
|
|
|
|
link_directories(${CURL_LIBRARY_DIRS})
|
|
|
|
link_directories(${CURLPP_LIBRARY_DIRS})
|
|
|
|
link_directories(${JSONCPP_LIBRARY_DIRS})
|
2018-05-27 16:08:49 +02:00
|
|
|
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
2018-05-13 07:01:30 +02:00
|
|
|
|
2018-05-11 02:21:44 +02:00
|
|
|
# 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(expandurl-mastodon ${sources})
|
2018-05-13 07:01:30 +02:00
|
|
|
target_link_libraries(expandurl-mastodon
|
|
|
|
${CURLPP_LIBRARIES} ${JSONCPP_LIBRARIES}
|
2018-05-27 16:08:49 +02:00
|
|
|
${LIBXDG_BASEDIR_LIBRARIES} mastodon-cpp pthread stdc++fs)
|
2018-05-11 02:21:44 +02:00
|
|
|
install(TARGETS expandurl-mastodon DESTINATION ${CMAKE_INSTALL_BINDIR})
|