From 39ad18efc042e9d095f197b021c4652362f9e4a9 Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 20 Dec 2019 01:13:19 +0100 Subject: [PATCH] Update CMake config for src/. --- src/CMakeLists.txt | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d605e6..dca891e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,37 +1,25 @@ include(GNUInstallDirs) -find_package(CURL REQUIRED) -find_package(Boost REQUIRED COMPONENTS system filesystem) -find_package(PkgConfig REQUIRED) -pkg_check_modules(CURLPP REQUIRED curlpp) -pkg_check_modules(JSONCPP REQUIRED jsoncpp) -include_directories(${PROJECT_SOURCE_DIR}/src) -include_directories(${PROJECT_BINARY_DIR}) +# The minimum versions should be in Debian oldstable, if possible. +find_package(Boost 1.62 REQUIRED COMPONENTS system filesystem) +find_package(jsoncpp 1.7 REQUIRED CONFIG) +find_package(CURL 7.52 REQUIRED) +find_package(Threads REQUIRED) +find_package(restclient-cpp 0.5 REQUIRED CONFIG) +find_package(mastodon-cpp REQUIRED CONFIG) -include_directories(${CURL_INCLUDE_DIR}) -include_directories(${CURLPP_INCLUDE_DIR}) -include_directories(${JSONCPP_INCLUDE_DIR}) -include_directories(${Boost_INCLUDE_DIRS}) - -link_directories(${CURL_LIBRARY_DIRS}) -link_directories(${CURLPP_LIBRARY_DIRS}) -link_directories(${JSONCPP_LIBRARY_DIRS}) -link_directories(${Boost_LIBRARY_DIRS}) - -add_definitions(${Boost_DEFINITIONS}) - -# Write version in header +# Write version in header. configure_file ( - "${PROJECT_SOURCE_DIR}/src/version.hpp.in" - "${PROJECT_BINARY_DIR}/version.hpp" -) + "${PROJECT_SOURCE_DIR}/src/version.hpp.in" + "${PROJECT_BINARY_DIR}/version.hpp") + +include_directories("${PROJECT_BINARY_DIR}") file(GLOB sources *.cpp) add_executable(mastorss ${sources}) target_link_libraries(mastorss - mastodon-cpp ${CURLPP_LIBRARIES} - ${JSONCPP_LIBRARIES} ${Boost_LIBRARIES} stdc++fs) -install(TARGETS mastorss DESTINATION ${CMAKE_INSTALL_BINDIR}) + mastodon-cpp::mastodon-cpp Boost::system Boost::filesystem restclient-cpp) +install(TARGETS mastorss DESTINATION "${CMAKE_INSTALL_BINDIR}") install(FILES watchwords.json - DESTINATION ${CMAKE_INSTALL_DATADIR}/mastorss) + DESTINATION "${CMAKE_INSTALL_DATADIR}/mastorss")